Minilisp.pm/t/unless.t

15 lines
407 B
Raku

(expect "unless - true condition"
(null (unless t 'fail)))
(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)))
(expect "unless - without body returns nil"
(null (unless nil)))
(expect "when - implicit progn"
(equal 'ok (unless nil 'wrong 'wrong2 'ok)))