Add test for throw and catch
This commit is contained in:
parent
34d4de92f0
commit
e6cb6bd047
1 changed files with 31 additions and 0 deletions
31
t/throw_catch.t
Normal file
31
t/throw_catch.t
Normal file
|
@ -0,0 +1,31 @@
|
|||
(expect "catch - without throw"
|
||||
(equal 'ok
|
||||
(catch 'exc1
|
||||
'ok)))
|
||||
|
||||
(expect "catch - with throw"
|
||||
(equal 'ok
|
||||
(catch 'exc2
|
||||
(throw 'exc2 'ok)
|
||||
'fail)))
|
||||
|
||||
(expect "catch - throw caught by inner catch"
|
||||
(equal 'ok
|
||||
(catch 'exc3a
|
||||
(catch 'exc3b
|
||||
(throw 'exc3b 'fail))
|
||||
'ok)))
|
||||
|
||||
(expect "catch - throw caught by outer catch"
|
||||
(equal 'ok
|
||||
(catch 'exc4a
|
||||
(catch 'exc4b
|
||||
(throw 'exc4a 'ok))
|
||||
'fail)))
|
||||
|
||||
(expect "catch - inner catch shadows outer catch"
|
||||
(equal 'ok
|
||||
(catch 'exc5
|
||||
(catch 'exc5
|
||||
(throw 'exc5 'fail))
|
||||
'ok)))
|
Loading…
Reference in a new issue