Skip to content

Commit 1c30e09

Browse files
committed
refactor: update resolving test stages and configuration
Simplify and consolidate resolving test stages in Makefile, stages_test.go, and tester_definition.go. Adjust stage slugs and test cases to focus on core identifier resolution and variable scoping functionality.
1 parent 961cfd5 commit 1c30e09

File tree

3 files changed

+13
-27
lines changed

3 files changed

+13
-27
lines changed

Makefile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -153,23 +153,13 @@ test_functions_w_jlox: build
153153
$(shell pwd)/dist/main.out
154154

155155
test_resolving_w_jlox: build
156-
CODECRAFTERS_REPOSITORY_DIR=./craftinginterpreters/build/gen/chap10_functions \
156+
CODECRAFTERS_REPOSITORY_DIR=./craftinginterpreters/build/gen/chap11_resolving \
157157
CODECRAFTERS_TEST_CASES_JSON="[ \
158-
{\"slug\":\"r1\",\"tester_log_prefix\":\"stage_701\",\"title\":\"Stage #701: Resolving: Scope Resolution\"}, \
159-
{\"slug\":\"r4\",\"tester_log_prefix\":\"stage_704\",\"title\":\"Stage #704: Resolving: Self Initialization\"}, \
160-
{\"slug\":\"r5\",\"tester_log_prefix\":\"stage_705\",\"title\":\"Stage #705: Resolving: Empty Return\"}, \
161-
{\"slug\":\"r6\",\"tester_log_prefix\":\"stage_706\",\"title\":\"Stage #706: Resolving: Undeclared Variables\"}, \
162-
{\"slug\":\"r7\",\"tester_log_prefix\":\"stage_707\",\"title\":\"Stage #707: Resolving: Variable Re-declaration\"} \
158+
{\"slug\":\"r1\",\"tester_log_prefix\":\"stage_701\",\"title\":\"Stage #701: Resolving: Identifier Resolution\"}, \
159+
{\"slug\":\"r2\",\"tester_log_prefix\":\"stage_704\",\"title\":\"Stage #704: Resolving: Self Initialization\"}, \
160+
{\"slug\":\"r3\",\"tester_log_prefix\":\"stage_707\",\"title\":\"Stage #707: Resolving: Variable Re-declaration\"}, \
161+
{\"slug\":\"r4\",\"tester_log_prefix\":\"stage_705\",\"title\":\"Stage #705: Resolving: Invalid Return\"} \
163162
]" \
164163
$(shell pwd)/dist/main.out
165164

166165
test_all: test_scanning_w_jlox test_parsing_w_jlox test_evaluation_w_jlox test_statements_w_jlox test_control_flow_w_jlox test_functions_w_jlox test_resolving_w_jlox
167-
168-
# Scope / Environment Resolution (Identifiers are resolved in different types of scopes)
169-
# Identifier Resolution (Variables, Functions, etc)
170-
# Static Analysis
171-
# Resolution and Binding
172-
# Lexical Environment / Scoping
173-
174-
# Basic Scope Resolution
175-
# Advanced Scope Resolution

internal/stages_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ func TestStages(t *testing.T) {
7676
NormalizeOutputFunc: normalizeTesterOutput,
7777
},
7878
"pass_resolving_inprogress_jlox": {
79-
StageSlugs: []string{"r1", "r4", "r5", "r6", "r7"},
79+
StageSlugs: []string{"r1", "r2", "r3", "r4"},
8080
CodePath: "../craftinginterpreters/build/gen/chap11_resolving",
8181
ExpectedExitCode: 0,
8282
StdoutFixturePath: "./test_helpers/fixtures/pass_resolving",
8383
NormalizeOutputFunc: normalizeTesterOutput,
8484
},
8585
"pass_resolving_completed_jlox": {
86-
StageSlugs: []string{"r1", "r4", "r5", "r6", "r7"},
86+
StageSlugs: []string{"r1", "r2", "r3", "r4"},
8787
CodePath: "../craftinginterpreters/build/gen/chap13_inheritance",
8888
ExpectedExitCode: 0,
8989
StdoutFixturePath: "./test_helpers/fixtures/pass_resolving_final",

internal/tester_definition.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,16 @@ var testerDefinition = tester_definition.TesterDefinition{
278278
TestFunc: createTestForRunCommandStage("r1"),
279279
},
280280
{
281-
Slug: "r4",
282-
TestFunc: createTestForRunCommandStage("r4"),
283-
},
284-
{
285-
Slug: "r5",
286-
TestFunc: createTestForRunCommandStage("r5"),
281+
Slug: "r2",
282+
TestFunc: createTestForRunCommandStage("r2"),
287283
},
288284
{
289-
Slug: "r6",
290-
TestFunc: createTestForRunCommandStage("r6"),
285+
Slug: "r3",
286+
TestFunc: createTestForRunCommandStage("r3"),
291287
},
292288
{
293-
Slug: "r7",
294-
TestFunc: createTestForRunCommandStage("r7"),
289+
Slug: "r4",
290+
TestFunc: createTestForRunCommandStage("r4"),
295291
},
296292
},
297293
}

0 commit comments

Comments
 (0)