summaryrefslogtreecommitdiff
path: root/interp/interpreter_test.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2026-01-24 23:06:55 +0100
committerMarc Vertes <mvertes@free.fr>2026-01-24 23:06:55 +0100
commit95c50e35888fb54ced38907dc6e97dc683937e70 (patch)
treefd68ffe15104f0c94700648c6893ed90a3d32423 /interp/interpreter_test.go
parent51e11a29f9d2a9e571c3ea7c406863a025749ad6 (diff)
fix: improve parsing of assign statements
Handle assign statements in parseAssign function. Detect multi-assign by the presence of comma in the right hand side tokens. The case of swap is not handled yet.
Diffstat (limited to 'interp/interpreter_test.go')
-rw-r--r--interp/interpreter_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/interp/interpreter_test.go b/interp/interpreter_test.go
index adb550b..27b7dd8 100644
--- a/interp/interpreter_test.go
+++ b/interp/interpreter_test.go
@@ -72,8 +72,9 @@ func TestExpr(t *testing.T) {
func TestAssign(t *testing.T) {
run(t, []etest{
- {src: "var a int = 1; a", res: "1"}, // #00
- {src: "var a, b int = 1, 2; b", res: "2"}, // #01
+ {src: "var a int = 1; a", res: "1"}, // #00
+ {src: "var a, b int = 1, 2; b", res: "2"}, // #01
+ {src: "var a, b int; a, b = 1, 2; b", res: "2"}, // #02
})
}