This commit is contained in:
2021-01-16 21:27:43 -07:00
parent a0a42e7ffd
commit 5be8276c42
3 changed files with 68 additions and 2 deletions

View File

@@ -269,6 +269,10 @@ class BasicTestCase extends Test {
function testAssignArith() {
_testAssignArith();
}
function testPatternLets() {
_testPatternLets();
}
}
class BasicObject {

View File

@@ -436,4 +436,20 @@
(/= num 25 2)
(Assert.equals 1 num)
(-= num 5 6)
(Assert.equals -10 num))
(Assert.equals -10 num))
(defun _testPatternLets []
(let [some5 (Some 5)
some6 (Some 6)
none None
:Null<Option<Any>> oops null]
(ifLet [(Some a) some5
(Some b) some6]
(Assert.equals 11 (+ a b))
(Assert.fail))
(ifLet [(Some a) oops]
(Assert.fail))
(ifLet [(Some (or 5 6)) some5]
(Assert.pass))
(ifLet [(Some a) none]
(Assert.fail))))