blob: fd2825b726124d66fdc8d95807c503430da605c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import TestPilot from require 'spec.test_setup'
describe "do", ->
COPILOT = TestPilot!
it "can be empty", ->
with COPILOT\eval_once '(do)'
assert.is.true \is_const!
assert.is.nil .result
it "returns the last result, if any", ->
with COPILOT\eval_once '(do 1 2 3)'
assert.is.true \is_const!
assert.is.equal '<num= 3>', tostring .result
with COPILOT\eval_once '(do 1 2 (def _ 3))'
assert.is.true \is_const!
assert.is.nil .result
it "passes through side-effects", ->
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
|