hy/tests/native_tests/unless.hy

9 lines
268 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) null))
(assert (= (unless (!= 1 2) 42) null))
(assert (= (unless (!= 2 2) 42) 42)))