File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ let float = import! std.float
77let int = import! std.int
88let list @ { List, ? } = import! std.list
99let { Foldable, foldl } = import! std.foldable
10- let { Option } = import! std.option
10+ let { Option, ? } = import! std.option
1111let { Result } = import! std.result
1212let { Semigroup, (<>) } = import! std.semigroup
1313let { error } = import! std.prim
@@ -56,6 +56,16 @@ let assert_gte l r : [Show a] -> [Ord a] -> a -> a -> Eff [| writer : Test | r |
5656 if l >= r then wrap ()
5757 else tell (Cons ("Assertion failed: " <> show l <> " < " <> show r) Nil)
5858
59+ let assert_some opt : Option a -> Eff [| writer : Test | r |] () =
60+ match opt with
61+ | Some _ -> wrap ()
62+ | None -> tell (Cons ("Assertion failed: expected Some, found None") Nil)
63+
64+ let assert_none opt : [Show a] -> Option a -> Eff [| writer : Test | r |] () =
65+ match opt with
66+ | Some x -> tell (Cons ("Assertion failed: expected None, found " <> show (Some x)) Nil)
67+ | None -> wrap ()
68+
5969let assert_ok res : [Show e] -> Result e a -> Eff [| writer : Test | r |] () =
6070 match res with
6171 | Ok _ -> wrap ()
@@ -108,6 +118,8 @@ rec let run_io test : TestEffIO r a -> IO () =
108118 assert_gt,
109119 assert_gte,
110120
121+ assert_some,
122+ assert_none,
111123 assert_ok,
112124 assert_err,
113125 assert_success,
You can’t perform that action at this time.
0 commit comments