Skip to content
Closed
2 changes: 1 addition & 1 deletion .github/workflows/fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
regenerate_fixtures:
if: github.event.label.name == 'regenerate-fixtures'
uses: codecrafters-io/tester-utils/.github/workflows/fixtures.yml@master
uses: codecrafters-io/tester-utils/.github/workflows/fixtures.yml@ci-make-setup
with:
tester_repo: interpreter-tester
secrets: inherit
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,36 @@ test_functions_w_jlox: build
$(shell pwd)/dist/main.out

test_all: test_scanning_w_jlox test_parsing_w_jlox test_evaluation_w_jlox test_statements_w_jlox test_control_flow_w_jlox

setup:
echo "Setting up interpreter-tester prerequisites for Linux"

# Clone repositories
git clone https://github.com/munificent/craftinginterpreters.git || true

# Install Dart
sudo apt-get update && sudo apt-get install apt-transport-https
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub \
| sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' \
| sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt-get update && sudo apt-get install dart=2.19.6-1

# Get Dart dependencies
cd craftinginterpreters && make get

# Update Scanner implementation
sed -i 's/Lox\.error(line, "Unexpected character\.");/Lox\.error(line, "Unexpected character: " + c);/g' craftinginterpreters/java/com/craftinginterpreters/lox/Scanner.java

# Compile jlox and copy test helpers
cd craftinginterpreters && make java_chapters
mkdir -p craftinginterpreters/build/gen/{chap04_scanning,chap06_parsing,chap07_evaluating,chap08_statements,chap09_control,chap10_functions,chap13_inheritance}
cp -r ./internal/test_helpers/jlox04/* craftinginterpreters/build/gen/chap04_scanning || true
cp -r ./internal/test_helpers/jlox06/* craftinginterpreters/build/gen/chap06_parsing || true
cp -r ./internal/test_helpers/jlox07/* craftinginterpreters/build/gen/chap07_evaluating || true
cp -r ./internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap08_statements || true
cp -r ./internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap09_control || true
cp -r ./internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap10_functions || true
cp -r ./internal/test_helpers/jlox08/* craftinginterpreters/build/gen/chap13_inheritance || true

echo "Setup complete!"
2 changes: 0 additions & 2 deletions internal/test_helpers/fixtures/pass_control_flow
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Debug = true
[stage-9] [test-1] Writing contents to ./test.lox:
[stage-9] [test-1] [test.lox] // This should print the string if the condition evaluates to True
[stage-9] [test-1] [test.lox] if (false) print "foo";
[stage-9] [test-1] [test.lox] if (false) print "foo";
[stage-9] [test-1] [test.lox] if (false) print "foo";
[stage-9] [test-1] $ ./your_program.sh run test.lox
[stage-9] [test-1] ✓ 1 line(s) match on stdout
[stage-9] [test-1] ✓ Received exit code 0.
Expand Down
2 changes: 0 additions & 2 deletions internal/test_helpers/fixtures/pass_control_flow_final
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Debug = true
[stage-9] [test-1] Writing contents to ./test.lox:
[stage-9] [test-1] [test.lox] // This should print the string if the condition evaluates to True
[stage-9] [test-1] [test.lox] if (false) print "foo";
[stage-9] [test-1] [test.lox] if (false) print "foo";
[stage-9] [test-1] [test.lox] if (false) print "foo";
[stage-9] [test-1] $ ./your_program.sh run test.lox
[stage-9] [test-1] ✓ 1 line(s) match on stdout
[stage-9] [test-1] ✓ Received exit code 0.
Expand Down
2 changes: 0 additions & 2 deletions test_programs/c1/1.lox
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
expected_error_type: none
---
// This should print the string if the condition evaluates to True
if (<<RANDOM_BOOLEAN>>) print "<<RANDOM_STRING>>";
if (<<RANDOM_BOOLEAN>>) print "<<RANDOM_STRING>>";
if (<<RANDOM_BOOLEAN>>) print "<<RANDOM_STRING>>";
Loading