diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2024-03-29 17:38:33 +0000 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2024-03-29 17:38:33 +0000 |
commit | ad0cde67e01a54a138acf760642d62aedbfece46 (patch) | |
tree | a0c680a93cb5042f89bb7552943fb210c4d6ae57 /subex/main_test.go | |
parent | 080a24e894f125d4f1741cfdcba7cb722304d209 (diff) | |
download | stred-go-ad0cde67e01a54a138acf760642d62aedbfece46.tar |
Add basic array manipulation
Diffstat (limited to 'subex/main_test.go')
-rw-r--r-- | subex/main_test.go | 113 |
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 { |