hspec-hedgehog icon indicating copy to clipboard operation
hspec-hedgehog copied to clipboard

"GaveUp" when using tests with guards

Open iko-deleted opened this issue 4 years ago • 1 comments

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

iko-deleted avatar Nov 26 '20 16:11 iko-deleted

This is a duplicate of https://github.com/parsonsmatt/hspec-hedgehog/issues/9.

sol avatar Nov 01 '23 04:11 sol