Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"GaveUp" when using tests with guards #15

Open
iko-deleted opened this issue Nov 26, 2020 · 1 comment
Open

"GaveUp" when using tests with guards #15

iko-deleted opened this issue Nov 26, 2020 · 1 comment

Comments

@iko-deleted
Copy link

any(?) tests using guards/discard will fail with GaveUp even when they should succeed

this test fails when used with hspec-hedgehog, but succeeds when run with the hedgehog check method

import Control.Monad (guard)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import Test.Hspec
import Test.Hspec.Hedgehog
import Prelude

list :: MonadGen m => m a -> m [a]
list = Gen.list (Range.constant 0 3)

prop :: PropertyT IO ()
prop = do
  l <- forAll (list Gen.bool)
  let (h : _) = l
  guard (l /= [])
  head l === h

main :: IO ()
main = do
  check $ property prop
  hspec $ it "???" $ hedgehog prop
@sol
Copy link
Member

sol commented Nov 1, 2023

This is a duplicate of #9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants