Skip to content

Commit 455409a

Browse files
committed
feat: Add new test fixture for failing multiline errors and remove old fixture
1 parent fe6e421 commit 455409a

File tree

5 files changed

+148
-72
lines changed

5 files changed

+148
-72
lines changed

internal/stages_test.go

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -54,69 +54,69 @@ func TestStages(t *testing.T) {
5454
StdoutFixturePath: "./test_helpers/fixtures/fail_scanning_multiline_errors/3_extra_line",
5555
NormalizeOutputFunc: normalizeTesterOutput,
5656
},
57-
// "pass_scanning_jlox": {
58-
// UntilStageSlug: "pq5",
59-
// CodePath: "../craftinginterpreters/build/gen/chap04_scanning",
60-
// ExpectedExitCode: 0,
61-
// StdoutFixturePath: "./test_helpers/fixtures/pass_scanning",
62-
// NormalizeOutputFunc: normalizeTesterOutput,
63-
// },
64-
// "pass_parsing_jlox": {
65-
// StageSlugs: []string{"wz8", "ht8", "uh4", "yf2", "wa9", "mq1", "xe6", "th5", "ra8", "sc2"},
66-
// CodePath: "../craftinginterpreters/build/gen/chap06_parsing",
67-
// ExpectedExitCode: 0,
68-
// StdoutFixturePath: "./test_helpers/fixtures/pass_parsing",
69-
// NormalizeOutputFunc: normalizeTesterOutput,
70-
// },
71-
// "pass_evaluating_jlox": {
72-
// StageSlugs: []string{"ib5", "cq1", "yu6", "gj9", "hw7", "et4", "jx8", "jy2", "bp3", "dc1", "oq9", "lv1", "iz6"},
73-
// CodePath: "../craftinginterpreters/build/gen/chap07_evaluating",
74-
// ExpectedExitCode: 0,
75-
// StdoutFixturePath: "./test_helpers/fixtures/pass_evaluating",
76-
// NormalizeOutputFunc: normalizeTesterOutput,
77-
// },
78-
// "pass_statements_inprogress_jlox": {
79-
// StageSlugs: []string{"xy1", "oe4", "fi3", "yg2", "sv7", "bc1", "dw9", "pl3", "vr5", "fb4"},
80-
// CodePath: "../craftinginterpreters/build/gen/chap08_statements",
81-
// ExpectedExitCode: 0,
82-
// StdoutFixturePath: "./test_helpers/fixtures/pass_statements",
83-
// NormalizeOutputFunc: normalizeTesterOutput,
84-
// },
85-
// "pass_statements_completed_jlox": {
86-
// StageSlugs: []string{"xy1", "oe4", "fi3", "yg2", "sv7", "bc1", "dw9", "pl3", "vr5", "fb4"},
87-
// CodePath: "../craftinginterpreters/build/gen/chap13_inheritance",
88-
// ExpectedExitCode: 0,
89-
// StdoutFixturePath: "./test_helpers/fixtures/pass_statements_final",
90-
// NormalizeOutputFunc: normalizeTesterOutput,
91-
// },
92-
// "pass_control_flow_inprogress_jlox": {
93-
// StageSlugs: []string{"ne3", "st5", "fh8", "xj4", "wk8", "jx4", "qy3", "bw6", "vt1"},
94-
// CodePath: "../craftinginterpreters/build/gen/chap09_control",
95-
// ExpectedExitCode: 0,
96-
// StdoutFixturePath: "./test_helpers/fixtures/pass_control_flow",
97-
// NormalizeOutputFunc: normalizeTesterOutput,
98-
// },
99-
// "pass_control_flow_completed_jlox": {
100-
// StageSlugs: []string{"ne3", "st5", "fh8", "xj4", "wk8", "jx4", "qy3", "bw6", "vt1"},
101-
// CodePath: "../craftinginterpreters/build/gen/chap13_inheritance",
102-
// ExpectedExitCode: 0,
103-
// StdoutFixturePath: "./test_helpers/fixtures/pass_control_flow_final",
104-
// NormalizeOutputFunc: normalizeTesterOutput,
105-
// },
106-
// "pass_functions_inprogress_jlox": {
107-
// StageSlugs: []string{"av4", "pg8", "lb6", "px4", "rd2", "ey3", "fj7", "bz4", "gg6"},
108-
// CodePath: "../craftinginterpreters/build/gen/chap10_functions",
109-
// ExpectedExitCode: 0,
110-
// StdoutFixturePath: "./test_helpers/fixtures/pass_functions",
111-
// NormalizeOutputFunc: normalizeTesterOutput,
112-
// },
113-
// "pass_functions_completed_jlox": {
114-
// StageSlugs: []string{"av4", "pg8", "lb6", "px4", "rd2", "ey3", "fj7", "bz4", "gg6"},
115-
// CodePath: "../craftinginterpreters/build/gen/chap13_inheritance",
116-
// ExpectedExitCode: 0,
117-
// StdoutFixturePath: "./test_helpers/fixtures/pass_functions_final",
118-
// NormalizeOutputFunc: normalizeTesterOutput,
119-
// },
57+
"pass_scanning_jlox": {
58+
UntilStageSlug: "pq5",
59+
CodePath: "../craftinginterpreters/build/gen/chap04_scanning",
60+
ExpectedExitCode: 0,
61+
StdoutFixturePath: "./test_helpers/fixtures/pass_scanning",
62+
NormalizeOutputFunc: normalizeTesterOutput,
63+
},
64+
"pass_parsing_jlox": {
65+
StageSlugs: []string{"wz8", "ht8", "uh4", "yf2", "wa9", "mq1", "xe6", "th5", "ra8", "sc2"},
66+
CodePath: "../craftinginterpreters/build/gen/chap06_parsing",
67+
ExpectedExitCode: 0,
68+
StdoutFixturePath: "./test_helpers/fixtures/pass_parsing",
69+
NormalizeOutputFunc: normalizeTesterOutput,
70+
},
71+
"pass_evaluating_jlox": {
72+
StageSlugs: []string{"ib5", "cq1", "yu6", "gj9", "hw7", "et4", "jx8", "jy2", "bp3", "dc1", "oq9", "lv1", "iz6"},
73+
CodePath: "../craftinginterpreters/build/gen/chap07_evaluating",
74+
ExpectedExitCode: 0,
75+
StdoutFixturePath: "./test_helpers/fixtures/pass_evaluating",
76+
NormalizeOutputFunc: normalizeTesterOutput,
77+
},
78+
"pass_statements_inprogress_jlox": {
79+
StageSlugs: []string{"xy1", "oe4", "fi3", "yg2", "sv7", "bc1", "dw9", "pl3", "vr5", "fb4"},
80+
CodePath: "../craftinginterpreters/build/gen/chap08_statements",
81+
ExpectedExitCode: 0,
82+
StdoutFixturePath: "./test_helpers/fixtures/pass_statements",
83+
NormalizeOutputFunc: normalizeTesterOutput,
84+
},
85+
"pass_statements_completed_jlox": {
86+
StageSlugs: []string{"xy1", "oe4", "fi3", "yg2", "sv7", "bc1", "dw9", "pl3", "vr5", "fb4"},
87+
CodePath: "../craftinginterpreters/build/gen/chap13_inheritance",
88+
ExpectedExitCode: 0,
89+
StdoutFixturePath: "./test_helpers/fixtures/pass_statements_final",
90+
NormalizeOutputFunc: normalizeTesterOutput,
91+
},
92+
"pass_control_flow_inprogress_jlox": {
93+
StageSlugs: []string{"ne3", "st5", "fh8", "xj4", "wk8", "jx4", "qy3", "bw6", "vt1"},
94+
CodePath: "../craftinginterpreters/build/gen/chap09_control",
95+
ExpectedExitCode: 0,
96+
StdoutFixturePath: "./test_helpers/fixtures/pass_control_flow",
97+
NormalizeOutputFunc: normalizeTesterOutput,
98+
},
99+
"pass_control_flow_completed_jlox": {
100+
StageSlugs: []string{"ne3", "st5", "fh8", "xj4", "wk8", "jx4", "qy3", "bw6", "vt1"},
101+
CodePath: "../craftinginterpreters/build/gen/chap13_inheritance",
102+
ExpectedExitCode: 0,
103+
StdoutFixturePath: "./test_helpers/fixtures/pass_control_flow_final",
104+
NormalizeOutputFunc: normalizeTesterOutput,
105+
},
106+
"pass_functions_inprogress_jlox": {
107+
StageSlugs: []string{"av4", "pg8", "lb6", "px4", "rd2", "ey3", "fj7", "bz4", "gg6"},
108+
CodePath: "../craftinginterpreters/build/gen/chap10_functions",
109+
ExpectedExitCode: 0,
110+
StdoutFixturePath: "./test_helpers/fixtures/pass_functions",
111+
NormalizeOutputFunc: normalizeTesterOutput,
112+
},
113+
"pass_functions_completed_jlox": {
114+
StageSlugs: []string{"av4", "pg8", "lb6", "px4", "rd2", "ey3", "fj7", "bz4", "gg6"},
115+
CodePath: "../craftinginterpreters/build/gen/chap13_inheritance",
116+
ExpectedExitCode: 0,
117+
StdoutFixturePath: "./test_helpers/fixtures/pass_functions_final",
118+
NormalizeOutputFunc: normalizeTesterOutput,
119+
},
120120
}
121121

122122
tester_utils_testing.TestTesterOutput(t, testerDefinition, testCases)

internal/test_helpers/fixtures/fail_scanning_errors_1

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[stage-11] Running tests for Stage #11: tz7
2+
[stage-11] [test-1] Running test case: 1
3+
[stage-11] [test-1] Writing contents to ./test.lox:
4+
[stage-11] [test-1] [test.lox] ()<|SPACE|><|TAB|>@
5+
[stage-11] [test-1] $ ./your_program.sh tokenize test.lox
6+
[your_program] [line 2] Error: Unexpected character: @
7+
[your_program] LEFT_PAREN ( null
8+
[your_program] RIGHT_PAREN ) null
9+
[your_program] EOF null
10+
[stage-11] [test-1] ✓ 1 line(s) match on stderr
11+
[stage-11] [test-1] ✓ 3 line(s) match on stdout
12+
[stage-11] [test-1] ✓ Received exit code 65.
13+
[stage-11] [test-2] Running test case: 2
14+
[stage-11] [test-2] Writing contents to ./test.lox:
15+
[stage-11] [test-2] [test.lox] @#
16+
[stage-11] [test-2] [test.lox] <|SPACE|>
17+
[stage-11] [test-2] $ ./your_program.sh tokenize test.lox
18+
[your_program] EOF null
19+
[your_program] [line 1] Error: Unexpected character: @
20+
[stage-11] [test-2] ✓ [line 1] Error: Unexpected character: @
21+
[stage-11] [test-2] 
22+
[stage-11] [test-2] [stderr] Missing line #2 from stderr: "[line 1] Error: Unexpected character: #"
23+
[stage-11] [test-2] [stderr] Perhaps it's printed to stdout? It should be printed to stderr.
24+
[stage-11] [test-2]  
25+
[stage-11] [test-2] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[stage-11] Running tests for Stage #11: tz7
2+
[stage-11] [test-1] Running test case: 1
3+
[stage-11] [test-1] Writing contents to ./test.lox:
4+
[stage-11] [test-1] [test.lox] ()<|SPACE|><|TAB|>@
5+
[stage-11] [test-1] $ ./your_program.sh tokenize test.lox
6+
[your_program] LEFT_PAREN ( null
7+
[your_program] RIGHT_PAREN ) null
8+
[your_program] EOF null
9+
[your_program] This line will be skipped in stderr
10+
[your_program] [line 2] Error: Unexpected character: @
11+
[stage-11] [test-1] ✓ 1 line(s) match on stderr
12+
[stage-11] [test-1] ✓ 3 line(s) match on stdout
13+
[stage-11] [test-1] ✓ Received exit code 65.
14+
[stage-11] [test-2] Running test case: 2
15+
[stage-11] [test-2] Writing contents to ./test.lox:
16+
[stage-11] [test-2] [test.lox] @#
17+
[stage-11] [test-2] [test.lox] <|SPACE|>
18+
[stage-11] [test-2] $ ./your_program.sh tokenize test.lox
19+
[your_program] EOF null
20+
[your_program] This line will be skipped in stderr
21+
[your_program] [line 1] Error: Unexpected character: @
22+
[your_program] This line will be skipped in stderr
23+
[your_program] [line 1] eRrRr: Unexpected character: #
24+
[stage-11] [test-2] ✓ [line 1] Error: Unexpected character: @
25+
[stage-11] [test-2] 
26+
[stage-11] [test-2] [stderr] Mismatch on line #2 of stderr:
27+
[stage-11] [test-2] [stderr] Expected: "[line 1] Error: Unexpected character: #"
28+
[stage-11] [test-2] [stderr] Actual : "[line 1] eRrRr: Unexpected character: #"
29+
[stage-11] [test-2]  
30+
[stage-11] [test-2] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[stage-11] Running tests for Stage #11: tz7
2+
[stage-11] [test-1] Running test case: 1
3+
[stage-11] [test-1] Writing contents to ./test.lox:
4+
[stage-11] [test-1] [test.lox] ()<|SPACE|><|TAB|>@
5+
[stage-11] [test-1] $ ./your_program.sh tokenize test.lox
6+
[your_program] LEFT_PAREN ( null
7+
[your_program] This line will be skipped in stderr
8+
[your_program] [line 2] Error: Unexpected character: @
9+
[your_program] RIGHT_PAREN ) null
10+
[your_program] EOF null
11+
[stage-11] [test-1] ✓ 1 line(s) match on stderr
12+
[stage-11] [test-1] ✓ 3 line(s) match on stdout
13+
[stage-11] [test-1] ✓ Received exit code 65.
14+
[stage-11] [test-2] Running test case: 2
15+
[stage-11] [test-2] Writing contents to ./test.lox:
16+
[stage-11] [test-2] [test.lox] @#
17+
[stage-11] [test-2] [test.lox] <|SPACE|>
18+
[stage-11] [test-2] $ ./your_program.sh tokenize test.lox
19+
[your_program] This line will be skipped in stderr
20+
[your_program] EOF null
21+
[your_program] [line 1] Error: Unexpected character: @
22+
[your_program] This line will be skipped in stderr
23+
[your_program] [line 1] Error: Unexpected character: #
24+
[your_program] [line 888] extra line
25+
[stage-11] [test-2] ✓ [line 1] Error: Unexpected character: @
26+
[stage-11] [test-2] ✓ [line 1] Error: Unexpected character: #
27+
[stage-11] [test-2] 
28+
[stage-11] [test-2] 𐄂 [stderr] Extra unexpected line in stderr: "[line 888] extra line"
29+
[stage-11] [test-2]  
30+
[stage-11] [test-2] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

0 commit comments

Comments
 (0)