case handle null. close #14

This commit is contained in:
2021-11-29 13:28:18 -07:00
parent 09e2898d42
commit 4a3acec4a1
4 changed files with 62 additions and 28 deletions

View File

@@ -351,7 +351,7 @@
(function _testCase []
(case (toOption [])
(None (Assert.pass))
((Some value) (Assert.fail)))
(otherwise (Assert.fail)))
(case (toOption "hey")
(None (Assert.fail))
((Some "hey") (Assert.pass))
@@ -589,4 +589,9 @@
(function _testEvalStatic []
(Assert.equals 9 (eval 'staticValue))
(assertThrows (eval 'value)))
(assertThrows (eval 'value)))
(function _testCaseOnNull []
(Assert.equals 5 (case null (v 10) (null 5)))
(Assert.equals 5 (case null (v 10) (null 5) (otherwise 6)))
(Assert.equals 5 (case null (v 10) (otherwise 5))))