From a4158c55432b1e1a10ad32f4f06a561b2e56c585 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Mon, 7 Nov 2016 11:23:12 -0800 Subject: [PATCH] Add tests for the empty keyword I have some macros for using pandas and NumPy that expect : to be a keyword instead of an ordinary symbol. These tests will ensure that we don't break this unless we want to. --- tests/native_tests/language.hy | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/native_tests/language.hy b/tests/native_tests/language.hy index 7ab27ad..261b49a 100644 --- a/tests/native_tests/language.hy +++ b/tests/native_tests/language.hy @@ -1047,6 +1047,19 @@ (assert (= (get {:foo "bar" ":foo" "quux"} :foo) "bar")) (assert (= (get {:foo "bar" ":foo" "quux"} ":foo") "quux"))) + +(defn test-empty-keyword [] + "NATIVE: test that the empty keyword is recognized" + (assert (= : :)) + (assert (keyword? :)) + (assert (!= : ":")) + (assert (= (name :) "")) + + (defn f [&kwargs kwargs] + (list (.items kwargs))) + (assert (= (f : 3) [(, "" 3)]))) + + (defn test-nested-if [] "NATIVE: test nested if" (for [x (range 10)]