aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/struct_spec.moon
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/struct_spec.moon')
-rw-r--r--spec/lib/struct_spec.moon9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/struct_spec.moon b/spec/lib/struct_spec.moon
index 94dcc5a..6f740ec 100644
--- a/spec/lib/struct_spec.moon
+++ b/spec/lib/struct_spec.moon
@@ -6,6 +6,15 @@ describe "struct", ->
ab = Struct { a: T.num, b: T.bool }
+ describe "literal", ->
+ it "can't be empty", ->
+ err = assert.has.error -> COPILOT\eval_once '{}'
+ assert.matches "syntax error: struct literal can't be empty", err
+
+ it "can't have uneven args", ->
+ err = assert.has.error -> COPILOT\eval_once '{3}'
+ assert.matches "syntax error: struct literal must have even number of values", err
+
describe "(set)", ->
it "can update values", ->
rt = COPILOT\eval_once '(set {"a" 1 "b" false} "a" 2)'