Skip to content

Commit

Permalink
exit failure on quickCheck fail
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierverdier committed Feb 3, 2015
1 parent 2986fec commit 55f8d37
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/TestBranchParse.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import BranchParse (BranchInfo(MkBranchInfo), branchInfo, Distance, Branch, noBranchInfo)
import Test.QuickCheck (property, stdArgs, maxSuccess, quickCheckWith)
import Test.QuickCheck (property, stdArgs, maxSuccess, quickCheckWithResult, Result, Property)
import Test.QuickCheck.Test (isSuccess)
import System.Exit (exitFailure)
import Control.Monad (forM, unless)


{- Helper to tackle the Either type -}
Expand Down Expand Up @@ -43,11 +46,21 @@ propBranchRemoteTracking b t distance =
(MkBranchInfo (Just b) (Just t) (Just distance))
$ show b ++ "..." ++ show t ++ " " ++ show distance

main :: IO()
main = mapM_ (quickCheckWith stdArgs { maxSuccess = 2^8 }) [

allTests :: [Property]
allTests = [
property propNoBranch,
property propNewRepo,
property propBranchOnly,
property propBranchRemote,
property propBranchRemoteTracking]
property propBranchRemoteTracking
]

runTests :: IO [Result]
runTests = forM allTests $ quickCheckWithResult stdArgs { maxSuccess = 256 }

main :: IO()
main = do
results <- runTests
unless (all isSuccess results) exitFailure

0 comments on commit 55f8d37

Please sign in to comment.