Minilisp.pm/t/when.t

18 lines
398 B
Perl
Raw Normal View History

2021-04-09 00:01:27 +02:00
(plan 5)
2021-04-04 01:53:18 +02:00
(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)))
(expect "when - without body returns nil"
(null (when t)))
(expect "when - implicit progn"
(equal 'ok (when t 'wrong 'wrong2 'ok)))