hy/tests/native_tests/unless.hy
gilch a22e2ca4cc purged null from Hy
we already have `nil`, and `null` was barely ever used.
2015-08-11 16:22:13 -06:00

11 lines
343 B
Hy

(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))
(assert (= (unless true 2) nil))
(assert (= (unless (!= 1 2) 42) None))
(assert (= (unless (!= 1 2) 42) nil))
(assert (= (unless (!= 2 2) 42) 42)))