Allow case guards, |

This commit is contained in:
2021-01-03 17:51:31 -07:00
parent 2e2e862f8a
commit f21b4378f6
3 changed files with 44 additions and 16 deletions

View File

@@ -330,7 +330,17 @@
((Some "hey") (Assert.pass))
(otherwise (Assert.fail)))
(Assert.equals 5 (case (toOption 0)
(otherwise 5))))
(otherwise 5)))
// Test case with guards and multiple values
(case 5
((or 5 6) (Assert.pass))
(otherwise (Assert.fail)))
(case [2 3]
((or [_ 3] [1 1]) (Assert.pass))
(otherwise (Assert.fail)))
(case 5
((when false (or 5 6)) (Assert.fail))
(otherwise (Assert.pass))))
(defun _testMaps []
(deflocal :Map<String,String> myMap [=>"hey" "you"
@@ -400,4 +410,4 @@
// Make sure built-in call aliases don't override user-defined variables
(defun _testCallAlias []
(let [map [=>"hey" "you"]]
(Assert.equals "you" (dictGet map "hey"))))
(Assert.equals "you" (dictGet map "hey"))))