<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'subex/main_test.go')
-rw-r--r--subex/main_test.go113
1 files changed, 113 insertions, 0 deletions
diff --git a/subex/main_test.go b/subex/main_test.go
index 0b4ee1b..78a62c4 100644
--- a/subex/main_test.go
+++ b/subex/main_test.go
@@ -69,6 +69,119 @@ func TestSubexMain(t *testing.T) {
walk.StringValue("ello"),
},
},
+ {
+ subex: "@(..$a`$a$a`{-0})@",
+ input: []walk.Value {
+ walk.ArrayValue {
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NullValue{},
+ },
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.BoolValue(true),
+ },
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NumberValue(5.4),
+ },
+ walk.ArrayElement {
+ Index: 5,
+ Value: walk.StringValue("hello"),
+ },
+ walk.ArrayElement {
+ Index: 3,
+ Value: walk.ArrayValue {
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ walk.ArrayElement {
+ Index: 1,
+ Value: walk.MapValue {
+ walk.MapElement {
+ Key: "key",
+ Value: walk.StringValue("value"),
+ },
+ },
+ },
+ },
+ },
+ expected: []walk.Value {
+ walk.ArrayValue {
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NullValue{},
+ },
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NullValue{},
+ },
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.BoolValue(true),
+ },
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.BoolValue(true),
+ },
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NumberValue(5.4),
+ },
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NumberValue(5.4),
+ },
+ walk.ArrayElement {
+ Index: 5,
+ Value: walk.StringValue("hello"),
+ },
+ walk.ArrayElement {
+ Index: 5,
+ Value: walk.StringValue("hello"),
+ },
+ walk.ArrayElement {
+ Index: 3,
+ Value: walk.ArrayValue {
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ walk.ArrayElement {
+ Index: 3,
+ Value: walk.ArrayValue {
+ walk.ArrayElement {
+ Index: 0,
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ walk.ArrayElement {
+ Index: 1,
+ Value: walk.MapValue {
+ walk.MapElement {
+ Key: "key",
+ Value: walk.StringValue("value"),
+ },
+ },
+ },
+ walk.ArrayElement {
+ Index: 1,
+ Value: walk.MapValue {
+ walk.MapElement {
+ Key: "key",
+ Value: walk.StringValue("value"),
+ },
+ },
+ },
+ },
+ },
+ },
}
for _, test := range tests {