mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-04 01:25:04 +03:00
One more test.
This commit is contained in:
parent
81bad8795c
commit
234aa9fe60
@ -73,6 +73,8 @@
|
||||
(Just x) (IO.println &x)
|
||||
(Nothing) (IO.println "nada"))))
|
||||
|
||||
(defn g []
|
||||
(match-ref &(Just (Just @"foooo"))
|
||||
(Just (Just x)) (IO.println x)))
|
||||
(defn deep [x]
|
||||
(match-ref x
|
||||
(Nothing) (IO.println "nothing")
|
||||
(Just (Nothing)) (IO.println "just nothing")
|
||||
(Just (Just x)) (IO.println x)))
|
||||
|
@ -35,12 +35,17 @@
|
||||
(Nest.Nested (Nest.Nested (Nest.Nested x)))
|
||||
x)
|
||||
"Match matches nested sumtype constructors with variables")
|
||||
|
||||
(assert-equal test
|
||||
"hello"
|
||||
(let [m (Maybe.Just @"hello")]
|
||||
(match-ref &m
|
||||
(Maybe.Nothing) "wrong"
|
||||
(Maybe.Just x ) x))
|
||||
"match-ref works on simple sumtype")
|
||||
(assert-equal test
|
||||
"found"
|
||||
(let [n (Nest.Nested (Nest.Nested (Nest.Nested @"found")))]
|
||||
(match-ref &n
|
||||
(Nest.Nested (Nest.Nested (Nest.Nested s))) s))
|
||||
"match-ref works on deeply nested sumtype"
|
||||
)
|
||||
"match-ref works on deeply nested sumtype")
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user