python2ruby/test/tester.sh
2025-12-02 13:57:45 +01:00

43 lines
No EOL
1 KiB
Bash
Executable file

#!/bin/bash
cd "$(dirname "$0")"
echo "=== LEXER TESTS ==="
for test in lexer/*.in; do
name=$(basename "$test" .in)
echo "Testing lexer/$name..."
if ! ../build/py2rb --dump-tokens --no-output --no-parsing < "$test" | diff - "lexer/${name}.out"; then
echo "FAILED: lexer/$name"
exit 1
fi
done
echo "✓ All lexer tests passed"
echo ""
echo "=== PARSER TESTS ==="
for test in parser/*.in; do
name=$(basename "$test" .in)
echo "Testing parser/$name..."
if ! ../build/py2rb --dump-ast --no-output < "$test" | diff - "parser/${name}.out"; then
echo "FAILED: parser/$name"
exit 1
fi
done
echo "✓ All parser tests passed"
echo ""
echo "=== Ruby output TESTS ==="
for test in ruby/*.in; do
name=$(basename "$test" .in)
echo "Testing ruby output/$name..."
if ! ../build/py2rb < "$test" | diff - "ruby/${name}.out"; then
echo "FAILED: ruby output/$name"
exit 1
fi
done
echo "✓ All ruby output tests passed"
. .
echo ""
echo "SUCCESS: All tests passed"