<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/main_test.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2024-03-30 21:09:32 +0000
committerCharlie Stanton <charlie@shtanton.xyz>2024-03-30 21:09:32 +0000
commitfd79fd18c6c32884e757e91b8629c87af4cbf34e (patch)
tree50e6b49c64b1c6cf230c80ce83a925ec98fd2387 /subex/main_test.go
parent976d96af62945178f3a3ab572620026df75003cf (diff)
downloadstred-go-fd79fd18c6c32884e757e91b8629c87af4cbf34e.tar
Add map destructure
Diffstat (limited to 'subex/main_test.go')
-rw-r--r--subex/main_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/subex/main_test.go b/subex/main_test.go
index 673b807..9c1819a 100644
--- a/subex/main_test.go
+++ b/subex/main_test.go
@@ -293,6 +293,41 @@ func TestSubexMain(t *testing.T) {
},
},
},
+ {
+ subex: "#(.(.$_){-0}):",
+ input: []walk.Value {
+ walk.MapValue {
+ {
+ Key: "a",
+ Value: walk.NullValue{},
+ },
+ {
+ Key: "b",
+ Value: walk.NumberValue(4),
+ },
+ {
+ Key: "c",
+ Value: walk.StringValue("hello"),
+ },
+ },
+ },
+ 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 {