<- 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.go77
1 files changed, 77 insertions, 0 deletions
diff --git a/subex/main_test.go b/subex/main_test.go
index 9c1819a..8e98798 100644
--- a/subex/main_test.go
+++ b/subex/main_test.go
@@ -79,6 +79,21 @@ func TestSubexMain(t *testing.T) {
},
},
{
+ subex: `#(".".{-0})-`,
+ input: []walk.Value {
+ walk.MapValue {
+ {
+ Key: "a",
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ expected: []walk.Value {
+ walk.StringValue("a"),
+ walk.NullValue{},
+ },
+ },
+ {
subex: "@(..$a`$a$a`{-0})@",
input: []walk.Value {
walk.ArrayValue {
@@ -328,6 +343,68 @@ func TestSubexMain(t *testing.T) {
},
},
},
+ {
+ subex: ":(.`null`{-0})#",
+ input: []walk.Value {
+ walk.ArrayValue {
+ {
+ Index: 0,
+ Value: walk.StringValue("a"),
+ },
+ {
+ Index: 1,
+ Value: walk.StringValue("b"),
+ },
+ {
+ Index: 2,
+ Value: walk.StringValue("c"),
+ },
+ },
+ },
+ expected: []walk.Value {
+ walk.MapValue {
+ {
+ Key: "a",
+ Value: walk.NullValue{},
+ },
+ {
+ Key: "b",
+ Value: walk.NullValue{},
+ },
+ {
+ Key: "c",
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ },
+ {
+ subex: `#(".$_(.{-0})".{-0})#`,
+ input: []walk.Value {
+ walk.MapValue {
+ {
+ Key: "hello",
+ Value: walk.NullValue{},
+ },
+ {
+ Key: "world",
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ expected: []walk.Value {
+ walk.MapValue {
+ {
+ Key: "ello",
+ Value: walk.NullValue{},
+ },
+ {
+ Key: "orld",
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ },
}
for i, test := range tests {