#TZ7 expects wrong output?

I’m stuck on Stage #TZ7.

I’ve implemented the error line correctly as far as I’m aware, but I don’t understand the first test.

Here are my logs:

~/proj/personal/codecrafters-interpreter-rust> codecrafters test
Initiating test run...

⚡ This is a turbo test run. https://codecrafters.io/turbo

Running tests. Logs should appear shortly...

[compile]    Compiling codecrafters-interpreter v0.1.0 (/app)
[compile]     Finished `release` profile [optimized] target(s) in 1.82s
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.

[tester::#TZ7] Running tests for Stage #TZ7 (Scanning: Multi-line errors)
[tester::#TZ7] [test-1] Running test case: 1
[tester::#TZ7] [test-1] Writing contents to ./test.lox:
[tester::#TZ7] [test-1] [test.lox] ()<|SPACE|><|TAB|>@
[tester::#TZ7] [test-1] $ ./your_program.sh tokenize test.lox
[your_program] LEFT_PAREN ( null
[your_program] RIGHT_PAREN ) null
[your_program] EOF  null
[your_program] [line 1] Error: Unexpected character: @
[tester::#TZ7] [test-1] 𐄂 [line 1] Error: Unexpected character: @
[tester::#TZ7] [test-1] Expected line #1 on stderr to be "[line 2] Error: Unexpected character: @", got "[line 1] Error: Unexpected character: @"
[tester::#TZ7] [test-1] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

View our article on debugging test failures: https://codecrafters.io/debug

So the question is, why does the test expect the error to be on line #2 whilst there are no newlines in the input? there’s only a tab and a space, why should the @ be on line 2?

Hi @Stef16Robbe, there is actually a newline present in the test case:

That said, we’ll work on fixing the display issue and keep you updated on any changes.

Thanks andy, I can’t believe my code was wrong! :wink:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.