Skip to content

"GaveUp" when using tests with guards #15

Open
@iko-deleted

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions