Add tests for 'or'
This commit is contained in:
parent
c79b2aabf4
commit
0cbc43927d
1 changed files with 13 additions and 4 deletions
17
t/and_or.t
17
t/and_or.t
|
@ -2,12 +2,21 @@
|
||||||
(and nil (set a 'fail))
|
(and nil (set a 'fail))
|
||||||
(expect "and - Short circuit" (equal a 'ok)))
|
(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"
|
(expect "and - returns last value if all operands evaluate to true"
|
||||||
(equal (and t 'ok) 'ok))
|
(equal (and t 'ok) 'ok))
|
||||||
|
|
||||||
(expect "and - returns nil if any operand evaluates to false"
|
(expect "and - returns nil if any operand evaluates to false"
|
||||||
(null (and nil t)))
|
(null (and nil t)))
|
||||||
|
|
||||||
|
(expect "and - returns nil if no operands supplied"
|
||||||
|
(null (and)))
|
||||||
|
|
||||||
|
(let ((a 'ok))
|
||||||
|
(or t (set a 'fail))
|
||||||
|
(expect "or - short circuit" (equal a 'ok)))
|
||||||
|
|
||||||
|
(expect "or - returns last value if all operands evaluate to false"
|
||||||
|
(equal (or nil 'ok) 'ok))
|
||||||
|
|
||||||
|
(expect "or - returns nil if no operands supplied"
|
||||||
|
(null (or)))
|
||||||
|
|
Loading…
Reference in a new issue