diff options
| author | Marc Vertes <mvertes@free.fr> | 2024-03-12 09:50:32 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2024-03-12 09:50:32 +0100 |
| commit | a3116a6613363f303b84f5f704f5e87495d4f3b9 (patch) | |
| tree | 3cf04ff2687e6e3f15bd96f752fc758aeac005c3 /parser/interpreter_test.go | |
| parent | 89e1575f1d7e542b843a53ba7434ac0f034a63fb (diff) | |
fix: force adding a return at end of function
This will avoid infinite loops, and is necessary for functions with
no returned values. This doesn't remove the need to better check the
consistency of return statements in general.
Diffstat (limited to 'parser/interpreter_test.go')
| -rw-r--r-- | parser/interpreter_test.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/parser/interpreter_test.go b/parser/interpreter_test.go index c3f2909..8f166df 100644 --- a/parser/interpreter_test.go +++ b/parser/interpreter_test.go @@ -97,6 +97,7 @@ func TestFunc(t *testing.T) { {src: "func f(a int) int {return a+2}; f(5) - f(3)", res: "2"}, {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"}, }) } |
