hy/tests/native_tests/when.hy
Julien Danjou f68e3b972b Add a `when' macro
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:04:35 +02:00

9 lines
248 B
Hy

(defn test-when []
"NATIVE: test when"
(assert (= (when true 1) 1))
(assert (= (when true 1 2) 2))
(assert (= (when true 1 3) 3))
(assert (= (when false 2) null))
(assert (= (when (= 1 2) 42) null))
(assert (= (when (= 2 2) 42) 42)))