Skip to content

Commit

Permalink
New success and classify function
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Nov 4, 2024
1 parent 8557539 commit 9e9774f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hedgehog/HaskellWorks/Polysemy/Hedgehog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module HaskellWorks.Polysemy.Hedgehog
trapFailJsonPretty,
trapFailYaml,

success,
failure,
failMessage,
assert,
Expand All @@ -46,6 +47,7 @@ module HaskellWorks.Polysemy.Hedgehog
evalIO_,
evalM_,

classify,
forAll,

catchAssertion,
Expand Down
15 changes: 15 additions & 0 deletions hedgehog/HaskellWorks/Polysemy/Hedgehog/Effect/Hedgehog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module HaskellWorks.Polysemy.Hedgehog.Effect.Hedgehog
trapAssertion,

forAll,
classify,
success,

hedgehogToMonadTestFinal,
hedgehogToPropertyFinal,
Expand Down Expand Up @@ -53,6 +55,11 @@ data Hedgehog m rv where
-> (H.Failure -> m a)
-> Hedgehog m a

Classify :: HasCallStack
=> H.LabelName
-> Bool
-> Hedgehog m ()

Eval :: HasCallStack
=> a
-> Hedgehog m a
Expand Down Expand Up @@ -112,6 +119,8 @@ hedgehogToMonadTestFinal = interpretFinal \case
h' <- bindS h
pure $ I.catchAssertion f' $ \e -> do
h' (e <$ s)
Classify labelName b ->
liftS $ H.classify labelName b
Eval a ->
liftS $ H.eval a
EvalIO f ->
Expand Down Expand Up @@ -156,3 +165,9 @@ forAll :: forall a r. ()
-> Sem r a
forAll =
embed . H.forAll

success :: forall r. ()
=> Member Hedgehog r
=> Sem r ()
success =
pure ()

0 comments on commit 9e9774f

Please sign in to comment.