Skip to content

Commit

Permalink
fix: fix formatting and apply naming suggesions
Browse files Browse the repository at this point in the history
  • Loading branch information
Etherian committed Oct 16, 2019
1 parent 3efac99 commit 6bb0d87
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions std/test.glu
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,25 @@ let assert_gte l r : [Show a] -> [Ord a] -> a -> a -> Eff [| writer : Test | r |
let assert_ok res : [Show e] -> Result e a -> Eff [| writer : Test | r |] () =
match res with
| Ok _ -> wrap ()
| Err e -> tell (Cons ("Assertion failed: found error " <> show e) Nil)
| Err e -> tell (Cons ("Assertion failed: found error: " <> show e) Nil)

let assert_err res : [Show a] -> Result e a -> Eff [| writer : Test | r |] () =
match res with
| Ok x -> tell (Cons ("Assertion failed: expected error, found " <> show x) Nil)
| Err _ -> wrap ()

let assert_errorless : [Show e] -> Eff [| error : Error e, writer : Test | r |] a -> Eff [| writer : Test | r |] () =
run_error >> flat_map assert_ok
let assert_success : [Show e]
-> Eff [| error : Error e, writer : Test | r |] a
-> Eff [| writer : Test | r |] ()
=
run_error
>> flat_map assert_ok

let assert_erroring : forall e . [Show a] -> Eff [| error : Error e, writer : Test | r |] a -> Eff [| writer : Test | r |] () =
run_error >> flat_map assert_err
let assert_throws : forall e .
[Show a] -> Eff [| error : Error e, writer : Test | r |] a -> Eff [| writer : Test | r |] ()
=
run_error
>> flat_map assert_err

rec let run_raw test : Eff [| writer : Test | r |] a -> Eff [| | r |] (List String) =
do test = run_writer test
Expand Down Expand Up @@ -99,8 +106,8 @@ rec let run_io test : TestEffIO r a -> IO () =
assert_neq,
assert_ok,
assert_err,
assert_errorless,
assert_erroring,
assert_success,
assert_throws,

run_raw,
run,
Expand Down

0 comments on commit 6bb0d87

Please sign in to comment.