#!/bin/bash # Debug the actual test function PROJECT_ROOT="/data/emu/rom-groomer" # Source everything like the real test source "$PROJECT_ROOT/tests/test-framework.sh" source "$PROJECT_ROOT/core/config.sh" source "$PROJECT_ROOT/core/logger.sh" # Initialize like the real test init_test_framework # Setup test environment TEST_CONVERTERS_DIR="$TEST_TEMP_DIR/converters" TEST_INPUT_DIR="$TEST_TEMP_DIR/input" TEST_OUTPUT_DIR="$TEST_TEMP_DIR/output" mkdir -p "$TEST_CONVERTERS_DIR" mkdir -p "$TEST_INPUT_DIR" mkdir -p "$TEST_OUTPUT_DIR" # Set test environment export LOG_LEVEL="ERROR" # Create invalid ZIP function create_invalid_zip() { local zip_name="$1" echo "PK this is not a valid zip file" > "${TEST_INPUT_DIR}/${zip_name}" } # Run the actual test function test_invalid_zip_file() { create_invalid_zip "invalid.zip" # Run converter and expect failure local output=$("${PROJECT_ROOT}/converters/convertFromZipCueToOggCue.sh" "${TEST_INPUT_DIR}/invalid.zip" 2>&1) local exit_code=$? echo "=== Debug Info ===" echo "Exit code: $exit_code" echo "Output length: ${#output}" echo "First 200 chars: ${output:0:200}" assert_not_equals 0 $exit_code "Invalid ZIP should fail with non-zero exit code" } echo "=== Running actual test function ===" CURRENT_TEST="test_invalid_zip_file" test_invalid_zip_file # Cleanup cleanup_test_framework