diff options
| author | s-ol <s+removethis@s-ol.nu> | 2022-01-27 15:35:18 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-02 14:24:49 +0000 |
| commit | 8b0ff802dbf2a45c9c1ce6d026bb1a646e709adf (patch) | |
| tree | 4945ceca327086ea96ad9b5b10e409b7c6d63aa7 /spec/lang/do_spec.moon | |
| parent | use base.match.any consistently (diff) | |
| download | alive-8b0ff802dbf2a45c9c1ce6d026bb1a646e709adf.tar.gz alive-8b0ff802dbf2a45c9c1ce6d026bb1a646e709adf.zip | |
clean up spec a bit
Diffstat (limited to 'spec/lang/do_spec.moon')
| -rw-r--r-- | spec/lang/do_spec.moon | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/spec/lang/do_spec.moon b/spec/lang/do_spec.moon index 310a75d..fd2825b 100644 --- a/spec/lang/do_spec.moon +++ b/spec/lang/do_spec.moon @@ -1,29 +1,27 @@ import TestPilot from require 'spec.test_setup' -import T, Struct, Array, Constant from require 'alv' describe "do", -> - COPILOT = TestPilot '' + COPILOT = TestPilot! it "can be empty", -> - rt = COPILOT\eval_once '(do)' - assert.is.true rt\is_const! - assert.is.nil rt.result + with COPILOT\eval_once '(do)' + assert.is.true \is_const! + assert.is.nil .result it "returns the last result, if any", -> - rt = COPILOT\eval_once '(do 1 2 3)' - assert.is.true rt\is_const! - assert.is.equal (Constant.num 3), rt.result + with COPILOT\eval_once '(do 1 2 3)' + assert.is.true \is_const! + assert.is.equal '<num= 3>', tostring .result - rt = COPILOT\eval_once '(do 1 2 (def _ 3))' - assert.is.true rt\is_const! - assert.is.nil rt.result + with COPILOT\eval_once '(do 1 2 (def _ 3))' + assert.is.true \is_const! + assert.is.nil .result it "passes through side-effects", -> - rt = COPILOT\eval_once ' - (import* time) - (do - (every 0.5 "bang! side-effect") - 3)' - assert.is.false rt\is_const! - assert.is.equal (Constant.num 3), rt.result - + with COPILOT\eval_once ' + (import* time) + (do + (every 0.5 "bang! side-effect") + 3)' + assert.is.false \is_const! + assert.is.equal '<num= 3>', tostring .result |
