From 89b5e92b830e3dd65c2f6284428893089669c940 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 12 May 2020 16:22:46 +0300 Subject: [PATCH] compiler: add tests for function literal Add test forgotten in #934. --- pkg/compiler/lambda_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 pkg/compiler/lambda_test.go diff --git a/pkg/compiler/lambda_test.go b/pkg/compiler/lambda_test.go new file mode 100644 index 000000000..d9ab32613 --- /dev/null +++ b/pkg/compiler/lambda_test.go @@ -0,0 +1,15 @@ +package compiler_test + +import ( + "math/big" + "testing" +) + +func TestFuncLiteral(t *testing.T) { + src := `package foo + func Main() int { + inc := func(x int) int { return x + 1 } + return inc(1) + inc(2) + }` + eval(t, src, big.NewInt(5)) +}