summaryrefslogtreecommitdiff
path: root/parser/interpreter_test.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2024-03-14 14:37:32 +0100
committerMarc Vertes <mvertes@free.fr>2024-03-14 14:37:32 +0100
commit378683d25bdae89fa446b2b82f8dda5d6b34ea33 (patch)
treecbf624e4eb38fafe51a12a718b48f43192cfcfac /parser/interpreter_test.go
parent60170bad25f912e0ba44e4c0095b54f6e26e307e (diff)
feat: initial support of closures
Also detection and automatic execution of main function. Make sure that all debug is output to stderr.
Diffstat (limited to 'parser/interpreter_test.go')
-rw-r--r--parser/interpreter_test.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/parser/interpreter_test.go b/parser/interpreter_test.go
index 8f166df..df44fae 100644
--- a/parser/interpreter_test.go
+++ b/parser/interpreter_test.go
@@ -98,6 +98,7 @@ func TestFunc(t *testing.T) {
{src: "func f(a int) int {return a+2}; f(3) - 2", res: "3"},
{src: "func f(a, b, c int) int {return a+b-c} ; f(7, 1, 3)", res: "5"},
{src: "var a int; func f() {a = a+2}; f(); a", res: "2"},
+ {src: "var f = func(a int) int {return a+3}; f(2)", res: "5"},
})
}