From 06c239e4f44849a3e4c8317194caacbcc47fc2d4 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sun, 14 Sep 2025 12:12:13 +0200 Subject: de/fn, loop parameter lists use square brackets --- spec/lib/struct_spec.moon | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec/lib/struct_spec.moon') 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)' -- cgit v1.2.3