aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/array_spec.moon
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/array_spec.moon')
-rw-r--r--spec/lib/array_spec.moon23
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/lib/array_spec.moon b/spec/lib/array_spec.moon
index 130138c..dcad2ad 100644
--- a/spec/lib/array_spec.moon
+++ b/spec/lib/array_spec.moon
@@ -6,15 +6,20 @@ describe "array", ->
svec3 = Array 3, T.str
- it "can contain any type", ->
- COPILOT\eval_once '[1 2 3]'
- COPILOT\eval_once '[true false]'
- COPILOT\eval_once '["a"]'
- COPILOT\eval_once '[[1 2] [3 4]]'
-
- it "cannot contain mixed types", ->
- err = assert.has.error -> COPILOT\eval_once '[1 false]'
- assert.matches "argument error: couldn't match arguments", err
+ describe "literal", ->
+ it "can't be empty", ->
+ err = assert.has.error -> COPILOT\eval_once '[]'
+ assert.matches "syntax error: array literal can't be empty", err
+
+ it "can contain any type", ->
+ COPILOT\eval_once '[1 2 3]'
+ COPILOT\eval_once '[true false]'
+ COPILOT\eval_once '["a"]'
+ COPILOT\eval_once '[[1 2] [3 4]]'
+
+ it "cannot contain mixed types", ->
+ err = assert.has.error -> COPILOT\eval_once '[1 false]'
+ assert.matches "argument error: couldn't match arguments", err
describe "(set)", ->
it "can swap values", ->