Add a few tests for various defn corner cases

Closes #302.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
Gergely Nagy 2015-08-10 13:44:11 +02:00
parent 2665b316cf
commit 1327d58882
No known key found for this signature in database
GPG Key ID: 0A083C5F06E0DD42
2 changed files with 14 additions and 0 deletions

View File

@ -519,3 +519,11 @@ def test_attribute_access():
def test_cons_correct():
"""Ensure cons gets compiled correctly"""
can_compile("(cons a b)")
def test_defn():
"""Ensure that defn works correctly in various corner cases"""
cant_compile("(defn if [] 1)")
cant_compile("(defn \"hy\" [] 1)")
cant_compile("(defn :hy [] 1)")
can_compile("(defn &hy [] 1)")

View File

@ -673,6 +673,12 @@
(assert (= 43 (my-fun 42))))
(defn test-defn-lambdakey []
"NATIVE: test defn with a &symbol function name"
(defn &hy [] 1)
(assert (= (&hy) 1)))
(defn test-defn-do []
"NATIVE: test defn evaluation order with do"
(setv acc [])