Skip to content

Commit

Permalink
test: add more test case for recursive functions
Browse files Browse the repository at this point in the history
  • Loading branch information
silverhairs committed Sep 3, 2023
1 parent fc43997 commit 9d8d15c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions glox/interpreter/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestInterpret(t *testing.T) {
`let count=0; while(count<1){count=count+1;}`: "1",
`let count=0; while(count<5){count=count+1;}`: "1\n2\n3\n4\n5",
`fun greets(name){print "Hello "+name+"!";}greets("John");`: "Hello John!\n<nil>",
`fun count(n) {if(n > 1) count(n-1); print n;} count(5);`: "1\n<nil>\n2\n<nil>\n3\n<nil>\n4\n<nil>\n5\n<nil>",
}

for code, expected := range fixtures {
Expand Down

0 comments on commit 9d8d15c

Please sign in to comment.