add nil as synonym for None

This commit is contained in:
Bob Tolbert 2013-12-27 13:50:19 -07:00
parent b2bb161cb0
commit 55a7ab1667
4 changed files with 9 additions and 3 deletions

View File

@ -229,6 +229,7 @@ def t_identifier(p):
table = {
"true": "True",
"false": "False",
"nil": "None",
"null": "None",
}

View File

@ -86,9 +86,10 @@
(defn test-is []
"NATIVE: test is can deal with None"
(setv a null)
(assert (is a null))
(assert (is-not a "b")))
(setv a nil)
(assert (is a nil))
(assert (is-not a "b"))
(assert (none? a)))
(defn test-branching []

View File

@ -4,5 +4,7 @@
(assert (= (unless false 1 2) 2))
(assert (= (unless false 1 3) 3))
(assert (= (unless true 2) null))
(assert (= (unless true 2) nil))
(assert (= (unless (!= 1 2) 42) null))
(assert (= (unless (!= 1 2) 42) nil))
(assert (= (unless (!= 2 2) 42) 42)))

View File

@ -5,4 +5,6 @@
(assert (= (when true 1 3) 3))
(assert (= (when false 2) null))
(assert (= (when (= 1 2) 42) null))
(assert (= (when false 2) nil))
(assert (= (when (= 1 2) 42) nil))
(assert (= (when (= 2 2) 42) 42)))