diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-08-19 14:45:31 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | 2bc0fe723d0f5cf2be5d84545b823dec0dbfb52b (patch) | |
| tree | ba0ff0449d9f56b53e55b9d4b9ae2b68662d5073 /spec/lang/array_spec.moon | |
| parent | add (failing) struct spec (diff) | |
| download | alive-2bc0fe723d0f5cf2be5d84545b823dec0dbfb52b.tar.gz alive-2bc0fe723d0f5cf2be5d84545b823dec0dbfb52b.zip | |
implement (set) as per spec
Diffstat (limited to 'spec/lang/array_spec.moon')
| -rw-r--r-- | spec/lang/array_spec.moon | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/lang/array_spec.moon b/spec/lang/array_spec.moon index 97632e3..25c0167 100644 --- a/spec/lang/array_spec.moon +++ b/spec/lang/array_spec.moon @@ -33,11 +33,11 @@ describe "array", -> it "checks value type", -> err = assert.has.error -> COPILOT\eval_once '(set (array 1) 0 "a")' - assert.matches "argument error: TBD", err + assert.matches "expected value for key '0' to be num, not str", err it "checks index range", -> err = assert.has.error -> COPILOT\eval_once '(set (array 1 2) -1 0)' - assert.matches "index '-1' out of range!", err + assert.matches "index '%-1' out of range!", err COPILOT\eval_once '(set (array 1 2) 0 0)' @@ -75,21 +75,21 @@ describe "array", -> assert.is.equal svec3\mk_const({ 'a', 'b', 'c' }), rt.result it "can insert a value", -> - rt = COPILOT\eval_once '(set (array "b" "c") 0 "a")' + rt = COPILOT\eval_once '(insert (array "b" "c") 0 "a")' assert.is.true rt\is_const! assert.is.equal svec3\mk_const({ 'a', 'b', 'c' }), rt.result - rt = COPILOT\eval_once '(set (array "a" "c") 1 "b")' + rt = COPILOT\eval_once '(insert (array "a" "c") 1 "b")' assert.is.true rt\is_const! assert.is.equal svec3\mk_const({ 'a', 'b', 'c' }), rt.result - rt = COPILOT\eval_once '(set (array "a" "b") 1 "c")' + rt = COPILOT\eval_once '(insert (array "a" "b") 1 "c")' assert.is.true rt\is_const! assert.is.equal svec3\mk_const({ 'a', 'b', 'c' }), rt.result it "checks index range", -> err = assert.has.error -> COPILOT\eval_once '(insert (array 1 2) -1 0)' - assert.matches "index '-1' out of range!", err + assert.matches "index '%-1' out of range!", err COPILOT\eval_once '(insert (array 1 2) 0 0)' @@ -117,7 +117,7 @@ describe "array", -> it "checks index range", -> err = assert.has.error -> COPILOT\eval_once '(remove (array 1 2 3) -1)' - assert.matches "index '-1' out of range!", err + assert.matches "index '%-1' out of range!", err err = assert.has.error -> COPILOT\eval_once '(remove (array 1 2 3) 3)' assert.matches "index '3' out of range!", err |
