hy/tests/native_tests/unless.hy

11 lines
343 B
Hy
Raw Normal View History

(defn test-unless []
"NATIVE: test unless"
(assert (= (unless false 1) 1))
(assert (= (unless false 1 2) 2))
(assert (= (unless false 1 3) 3))
(assert (= (unless true 2) None))
2013-12-27 21:50:19 +01:00
(assert (= (unless true 2) nil))
(assert (= (unless (!= 1 2) 42) None))
2013-12-27 21:50:19 +01:00
(assert (= (unless (!= 1 2) 42) nil))
(assert (= (unless (!= 2 2) 42) 42)))