summaryrefslogtreecommitdiff
path: root/interp/interpreter_test.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2025-12-02 15:45:14 +0100
committerMarc Vertes <mvertes@free.fr>2025-12-02 15:45:14 +0100
commit3d64f909cfb55d8886ac4b4839a98f8f6cdc98e7 (patch)
treec0e4149ef652f2d422d2f598da1651fde4009496 /interp/interpreter_test.go
parentf40a1c23467eef36f53635e525f8b25f591e8a45 (diff)
feat: support of struct literal composite
Added missing vm instructions to allocate a typed value on the stack and to set a structure field. It's possible now to generate struct literal composites for non keyed struct fields.
Diffstat (limited to 'interp/interpreter_test.go')
-rw-r--r--interp/interpreter_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/interp/interpreter_test.go b/interp/interpreter_test.go
index 21e6274..42cb7e2 100644
--- a/interp/interpreter_test.go
+++ b/interp/interpreter_test.go
@@ -258,6 +258,7 @@ func TestComposite(t *testing.T) {
run(t, []etest{
{src: "type T struct{}; t := T{}; t", res: "{}"},
{src: "t := struct{}{}; t", res: "{}"},
- // {src: `type T struct{N int; S string}; t := T{2, "foo"}`, res: `{2 foo}`},
+ {src: `type T struct {}; var t T; t = T{}; t`, res: "{}"},
+ {src: `type T struct{N int; S string}; var t T; t = T{2, "foo"}; t`, res: `{2 foo}`},
})
}