summaryrefslogtreecommitdiff
path: root/parser/interpreter_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'parser/interpreter_test.go')
-rw-r--r--parser/interpreter_test.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/parser/interpreter_test.go b/parser/interpreter_test.go
index ac8dfc4..255f7c5 100644
--- a/parser/interpreter_test.go
+++ b/parser/interpreter_test.go
@@ -180,6 +180,14 @@ func TestConst(t *testing.T) {
})
}
+func TestStruct(t *testing.T) {
+ run(t, []etest{
+ {src: "type T struct {a string; b, c int}; var t T; t", res: "{ 0 0}"},
+ {src: "type T struct {a int}; var t T; t.a", res: "0"},
+ {src: "type T struct {a int}; var t T; t.a = 1; t.a", res: "1"},
+ })
+}
+
func TestType(t *testing.T) {
src0 := `type(
I int
@@ -190,7 +198,6 @@ func TestType(t *testing.T) {
{src: "type t int; var a t = 1; a", res: "1"},
{src: "type t = int; var a t = 1; a", res: "1"},
{src: src0 + `var s S = "xx"; s`, res: "xx"},
- {src: "type T struct {a string; b, c int}; var t T; t", res: "{ 0 0}"},
})
}