14 lines
377 B
Perl
14 lines
377 B
Perl
|
(let ((a 'ok))
|
||
|
(and nil (set a 'fail))
|
||
|
(expect "and - Short circuit" (equal a 'ok)))
|
||
|
|
||
|
;; (let ((a 'ok))
|
||
|
;; (or t (set a 'fail))
|
||
|
;; (expect "or - short circuit" (equal a 'ok)))
|
||
|
|
||
|
(expect "and - returns last value if all operands evaluate to true"
|
||
|
(equal (and t 'ok) 'ok))
|
||
|
|
||
|
(expect "and - returns nil if any operand evaluates to false"
|
||
|
(null (and nil t)))
|