diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/data/collection/dictionary.lux | 19 | ||||
-rw-r--r-- | stdlib/source/test/lux/data/collection/row.lux | 17 |
2 files changed, 22 insertions, 14 deletions
diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 432909629..55b569a31 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -9,6 +9,8 @@ [/ ["$." equivalence] ["$." functor (#+ Injection)]]}] + [control + ["." try]] [data ["." maybe] [number @@ -67,15 +69,20 @@ _ #1)) (_.test "Should be able to try-put and then get a value." - (case (/.get non-key (/.try-put non-key test-val dict)) - (#.Some v) (n.= test-val v) - _ #1)) + (case (/.try-put non-key test-val dict) + (#try.Success dict) + (case (/.get non-key dict) + (#.Some v) (n.= test-val v) + _ true) + + (#try.Failure _) + false)) (_.test "Shouldn't be able to try-put an existing key." (or (n.= 0 size) (let [first-key (|> dict /.keys list.head maybe.assume)] - (case (/.get first-key (/.try-put first-key test-val dict)) - (#.Some v) (not (n.= test-val v)) - _ #1)))) + (case (/.try-put first-key test-val dict) + (#try.Success _) false + (#try.Failure _) true)))) (_.test "Removing a key should make it's value inaccessible." (let [base (/.put non-key test-val dict)] (and (/.contains? non-key base) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 80917c7eb..c6f462825 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -12,8 +12,9 @@ ["$." functor (#+ Injection)] ["$." apply] ["$." monad]]}] + [control + ["." try]] [data - ["." maybe] [number ["n" nat]] [collection @@ -54,19 +55,19 @@ (and (n.= (inc size) (/.size (/.add non-member sample))) (n.= (dec size) (/.size (/.pop sample))))) (_.test (format (%.name (name-of /.put)) - " " (%.name (name-of /.nth))) + " &&& " (%.name (name-of /.nth))) (|> sample - (/.put idx non-member) - (/.nth idx) - maybe.assume + (/.put idx non-member) try.assume + (/.nth idx) try.assume (is? non-member))) (_.test (%.name (name-of /.update)) (|> sample - (/.put idx non-member) (/.update idx inc) - (/.nth idx) maybe.assume + (/.put idx non-member) try.assume + (/.update idx inc) try.assume + (/.nth idx) try.assume (n.= (inc non-member)))) (_.test (format (%.name (name-of /.to-list)) - " " (%.name (name-of /.from-list))) + " &&& " (%.name (name-of /.from-list))) (|> sample /.to-list /.from-list (/@= sample))) (_.test (%.name (name-of /.member?)) (and (not (/.member? n.equivalence sample non-member)) |