Add test for blocks
This commit is contained in:
parent
a355528492
commit
2e784310fb
1 changed files with 42 additions and 0 deletions
42
t/block.t
Normal file
42
t/block.t
Normal file
|
@ -0,0 +1,42 @@
|
|||
(expect "block - return last value"
|
||||
(equal 'top (block nil 'top)))
|
||||
|
||||
(expect "block - return"
|
||||
(equal 'ok
|
||||
(block nil
|
||||
'test1
|
||||
(return 'ok)
|
||||
'fail)))
|
||||
|
||||
(expect "block - return-from"
|
||||
(equal 'ok
|
||||
(block banana
|
||||
'a
|
||||
'b
|
||||
(return-from banana 'ok)
|
||||
'c
|
||||
'd)))
|
||||
|
||||
(expect "block - return-from inner block"
|
||||
(equal 'ok
|
||||
(block outer
|
||||
'a
|
||||
'b
|
||||
(block inner
|
||||
'c
|
||||
(return-from inner 'fail)
|
||||
'd)
|
||||
'e
|
||||
'ok)))
|
||||
|
||||
(expect "block - return-from outer block"
|
||||
(equal 'ok
|
||||
(block outer
|
||||
'a
|
||||
'b
|
||||
(block inner
|
||||
'c
|
||||
(return-from outer 'ok)
|
||||
'd)
|
||||
'e
|
||||
'fail)))
|
Loading…
Reference in a new issue