Minilisp.pm/t/when.t
MadMaurice c954f0216f when, unless: check for wrongful evaluation
when and unless must not evaluate their bodies if the condition does not require it.
2021-04-05 04:07:22 +02:00

9 lines
238 B
Raku

(expect "when - true condition"
(equal 'ok (when t 'ok)))
(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)))