0 | module Test.Async.Spec.Asserts
2 | import Data.Linear.Ref1
5 | import Test.Async.Spec.Report
6 | import Test.Async.Spec.TestEnv
7 | import Test.Async.Spec.TestResult
8 | import Text.Show.Diff
9 | import Text.Show.Pretty
14 | failWith : Maybe Diff -> String -> Test e
15 | failWith diff msg = pure $
Failure diff msg
19 | failDiff : Show a => Show b => a -> b -> Test e
21 | case valueDiff <$> reify x <*> reify y of
32 | Just vdiff@(Same _) =>
34 | (Just $
MkDiff "━━━ Failed (" "" "no differences" "" ") ━━━" vdiff)
39 | (Just $
MkDiff "━━━ Failed (" "- lhs" ") (" "+ rhs" ") ━━━" vdiff)
43 | diff : Show a => Show b => a -> (a -> b -> Bool) -> b -> Test e
44 | diff x op y = if x `op` y then pure Success else failDiff x y
46 | export infix 6 ===
, =!=
50 | (===) : Eq a => Show a => a -> a -> Test e
51 | (===) x y = diff x (==) y
55 | {auto all : All Interpolation es}
56 | -> {auto showa : Show a}
57 | -> {auto eqa : Eq a}
64 | Succeeded res => res === exp
66 | let msg := collapse' $
hzipWith (\_ => interpolate) all err
67 | in failWith Nothing "Computation failed with error \{msg}"
69 | failWith Nothing "Computation was canceled unexpectedly"
74 | {auto all : All Interpolation es}
75 | -> {auto showa : Show a}
76 | -> {auto eqa : Eq a}