diff --git a/tests/DListProperties.hs b/tests/DListProperties.hs index 2e7fd1c..b30a666 100644 --- a/tests/DListProperties.hs +++ b/tests/DListProperties.hs @@ -26,7 +26,7 @@ -------------------------------------------------------------------------------- -- | QuickCheck property tests for DList. -module DListProperties (test) where +module DListProperties (properties) where -------------------------------------------------------------------------------- @@ -189,6 +189,3 @@ properties = ("Semigroup stimes", property prop_Semigroup_stimes) #endif ] - -test :: IO () -test = quickCheckLabeledProperties properties diff --git a/tests/DNonEmptyProperties.hs b/tests/DNonEmptyProperties.hs index 96caa4d..6123930 100644 --- a/tests/DNonEmptyProperties.hs +++ b/tests/DNonEmptyProperties.hs @@ -8,7 +8,7 @@ -------------------------------------------------------------------------------- -- | QuickCheck property tests for DNonEmpty. -module DNonEmptyProperties (test) where +module DNonEmptyProperties (properties) where -------------------------------------------------------------------------------- @@ -104,6 +104,3 @@ properties = ("fromList", property prop_fromList), ("Semigroup <>", property prop_Semigroup_append) ] - -test :: IO () -test = quickCheckLabeledProperties properties diff --git a/tests/Main.hs b/tests/Main.hs index 4481863..b69f40a 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -18,14 +18,20 @@ import qualified DListProperties import qualified DNonEmptyProperties #endif import qualified OverloadedStrings +import QuickCheckUtil (quickCheckLabeledProperties) +import Control.Monad (unless) +import Test.QuickCheck (isSuccess) +import System.Exit (exitFailure) -------------------------------------------------------------------------------- main :: IO () main = do - DListProperties.test + result <- quickCheckLabeledProperties $ + DListProperties.properties -- CPP: GHC >= 8 for DNonEmpty #if __GLASGOW_HASKELL__ >= 800 - DNonEmptyProperties.test + ++ DNonEmptyProperties.properties #endif OverloadedStrings.test + unless (isSuccess result) exitFailure diff --git a/tests/QuickCheckUtil.hs b/tests/QuickCheckUtil.hs index 0fa89a0..28fb8a9 100644 --- a/tests/QuickCheckUtil.hs +++ b/tests/QuickCheckUtil.hs @@ -40,8 +40,8 @@ eqOn c f g x = c x ==> f x == g x -------------------------------------------------------------------------------- -quickCheckLabeledProperties :: [(String, Property)] -> IO () -quickCheckLabeledProperties = quickCheck . conjoin . map (uncurry label) +quickCheckLabeledProperties :: [(String, Property)] -> IO Result +quickCheckLabeledProperties = quickCheckResult . conjoin . map (uncurry label) --------------------------------------------------------------------------------