Make Tock work with QuickCheck 2.1.0.3.
This is the slightly older version that Debian stable is current shipping; it has fewer fields in its Result structure, so we need to be more flexible about pattern-matching (which is probably a good thing anyway).
This commit is contained in:
parent
75d4684a1d
commit
e40226ce02
|
@ -37,7 +37,7 @@ import PrettyShow
|
|||
|
||||
instance Error QCP.Result where
|
||||
noMsg = strMsg ""
|
||||
strMsg s = QCP.failed { QCP.reason = s }
|
||||
strMsg s = QCP.result { QCP.ok = Just False, QCP.reason = s }
|
||||
|
||||
class Monad m => TestMonad m r | m -> r where
|
||||
runTest :: m () -> r
|
||||
|
@ -51,7 +51,7 @@ instance TestMonad IO Assertion where
|
|||
|
||||
instance TestMonad (Either QCP.Result) QCP.Result where
|
||||
runTest = either id (const QCP.succeeded)
|
||||
testFailure s = Left $ QCP.failed { QCP.reason = s }
|
||||
testFailure s = Left $ QCP.result { QCP.ok = Just False, QCP.reason = s }
|
||||
runIO f = return (unsafePerformIO f)
|
||||
|
||||
compareForResult :: TestMonad m r => String -> (a -> String) -> (a -> a -> Bool) -> a -> a -> m ()
|
||||
|
|
|
@ -85,12 +85,12 @@ testCheck :: Testable a => Args -> a -> Test
|
|||
testCheck args property =
|
||||
TestCase $ do result <- quickCheckWithResult args property
|
||||
case result of
|
||||
Success _ _ _ -> return ()
|
||||
GaveUp _ _ _ -> return ()
|
||||
Failure numTests _ _ _ reason _ _ ->
|
||||
assertFailure $ "Falsifiable, after " ++ show numTests ++ " tests:\n" ++ reason
|
||||
NoExpectedFailure numTests _ _ ->
|
||||
assertFailure $ "No expected failure, after " ++ show numTests ++ " tests"
|
||||
Success {} -> return ()
|
||||
GaveUp {} -> return ()
|
||||
Failure {} ->
|
||||
assertFailure $ "Falsifiable: " ++ (reason result)
|
||||
NoExpectedFailure {} ->
|
||||
assertFailure $ "No expected failure"
|
||||
|
||||
--}}}
|
||||
--{{{ building AST fragments and patterns
|
||||
|
|
Loading…
Reference in New Issue
Block a user