@@ -10,6 +10,7 @@ import Effect.Class (liftEffect)
10
10
import Data.Foldable (intercalate )
11
11
import Data.List (mapMaybe , length )
12
12
import Data.Maybe (Maybe (..))
13
+ import Data.Tuple (Tuple (..))
13
14
import Effect.Aff (Aff , error , throwError )
14
15
import Test.QuickCheck as QC
15
16
@@ -30,9 +31,13 @@ quickCheck' n prop = do
30
31
seed <- liftEffect QC .randomSeed
31
32
quickCheckPure seed n prop
32
33
33
- getErrorMessage :: QC.Result -> Maybe String
34
- getErrorMessage (QC.Failed msg) = Just msg
35
- getErrorMessage _ = Nothing
34
+ getErrorMessage :: Tuple QC.Seed QC.Result -> Maybe String
35
+ getErrorMessage (Tuple seed result) =
36
+ case result of
37
+ QC.Success -> Nothing
38
+ QC.Failed msg ->
39
+ Just $
40
+ " Test (seed " <> show (QC .unSeed seed) <> " ) failed: \n " <> msg
36
41
37
42
-- | Runs a Testable with a given seed and number of inputs.
38
43
quickCheckPure :: forall p .
@@ -42,7 +47,7 @@ quickCheckPure :: forall p.
42
47
p ->
43
48
Aff Unit
44
49
quickCheckPure seed n prop = do
45
- let results = QC .quickCheckPure seed n prop
50
+ let results = QC .quickCheckPure' seed n prop
46
51
let msgs = mapMaybe getErrorMessage results
47
52
48
53
if length msgs > 0
0 commit comments