when, unless: check for wrongful evaluation
when and unless must not evaluate their bodies if the condition does not require it.
This commit is contained in:
parent
9c0db610bf
commit
c954f0216f
2 changed files with 8 additions and 0 deletions
|
@ -3,3 +3,7 @@
|
|||
|
||||
(expect "unless - false condition"
|
||||
(equal 'ok (unless nil 'ok)))
|
||||
|
||||
(let ((a 'ok))
|
||||
(unless t (set a 'fail))
|
||||
(expect "unless - does not evaluate on true" (equal a 'ok)))
|
||||
|
|
4
t/when.t
4
t/when.t
|
@ -3,3 +3,7 @@
|
|||
|
||||
(expect "when - false condition"
|
||||
(null (when nil 'fail)))
|
||||
|
||||
(let ((a 'ok))
|
||||
(when nil (set a 'fail))
|
||||
(expect "when - does not evaluate on false" (equal a 'ok)))
|
||||
|
|
Loading…
Reference in a new issue