aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lang/do_spec.moon
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-08-19 13:32:59 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:24:49 +0000
commit9f6544e2d5a7ad153a03ee36254dccf4900377d2 (patch)
tree76f23b2681ffb067dbc06129f98a017a2d00a7e5 /spec/lang/do_spec.moon
parentbugfixes with compound type comparisons (diff)
downloadalive-9f6544e2d5a7ad153a03ee36254dccf4900377d2.tar.gz
alive-9f6544e2d5a7ad153a03ee36254dccf4900377d2.zip
add TestPilot:eval_once
Diffstat (limited to 'spec/lang/do_spec.moon')
-rw-r--r--spec/lang/do_spec.moon28
1 files changed, 12 insertions, 16 deletions
diff --git a/spec/lang/do_spec.moon b/spec/lang/do_spec.moon
index eecc326..67b7b33 100644
--- a/spec/lang/do_spec.moon
+++ b/spec/lang/do_spec.moon
@@ -5,29 +5,25 @@ describe "do", ->
COPILOT = TestPilot ''
it "can be empty", ->
- COPILOT.active_module\spit '(do)'
- COPILOT\tick!
- assert.is.true COPILOT.active_module.root\is_const!
- assert.is.nil COPILOT.active_module.root.result
+ rt = COPILOT\eval_once '(do)'
+ assert.is.true rt\is_const!
+ assert.is.nil rt.result
it "returns the last result, if any", ->
- COPILOT.active_module\spit '(do 1 2 3)'
- COPILOT\tick!
- assert.is.true COPILOT.active_module.root\is_const!
- assert.is.equal (Constant.num 3), COPILOT.active_module.root.result
+ rt = COPILOT\eval_once '(do 1 2 3)'
+ assert.is.true rt\is_const!
+ assert.is.equal (Constant.num 3), rt.result
- COPILOT.active_module\spit '(do 1 2 (trace 3))'
- COPILOT\tick!
- assert.is.true COPILOT.active_module.root\is_const!
- assert.is.nil COPILOT.active_module.root.result
+ rt = COPILOT\eval_once '(do 1 2 (trace 3))'
+ assert.is.true rt\is_const!
+ assert.is.nil rt.result
it "passes through side-effects", ->
- COPILOT.active_module\spit '
+ rt = COPILOT\eval_once '
(import* time)
(do
(every 0.5 "bang! side-effect")
3)'
- COPILOT\tick!
- assert.is.false COPILOT.active_module.root\is_const!
- assert.is.equal (Constant.num 3), COPILOT.active_module.root.result
+ assert.is.false rt\is_const!
+ assert.is.equal (Constant.num 3), rt.result