<- 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.go58
1 files changed, 58 insertions, 0 deletions
diff --git a/subex/main_test.go b/subex/main_test.go
index d7424b3..673b807 100644
--- a/subex/main_test.go
+++ b/subex/main_test.go
@@ -235,6 +235,64 @@ func TestSubexMain(t *testing.T) {
walk.StringValue("abcdefghijklm"),
},
},
+ {
+ subex: ":(.)-",
+ input: []walk.Value {
+ walk.ArrayValue {
+ {
+ Index: 0,
+ Value: walk.NullValue{},
+ },
+ },
+ },
+ expected: []walk.Value {
+ walk.NullValue{},
+ },
+ },
+ {
+ subex: ":(.{-0}+)-",
+ input: []walk.Value {
+ walk.ArrayValue {
+ {
+ Index: 0,
+ Value: walk.NumberValue(4),
+ },
+ {
+ Index: 1,
+ Value: walk.NumberValue(-123),
+ },
+ {
+ Index: 2,
+ Value: walk.NumberValue(124),
+ },
+ },
+ },
+ expected: []walk.Value {
+ walk.NumberValue(5),
+ },
+ },
+ {
+ subex: "~(-(.)~{-0}):",
+ input: []walk.Value {
+ walk.StringValue("abc"),
+ },
+ expected: []walk.Value {
+ walk.ArrayValue {
+ {
+ Index: 0,
+ Value: walk.StringValue("a"),
+ },
+ {
+ Index: 0,
+ Value: walk.StringValue("b"),
+ },
+ {
+ Index: 0,
+ Value: walk.StringValue("c"),
+ },
+ },
+ },
+ },
}
for i, test := range tests {