quickcheck-io 0.1.1 → 0.2.0
raw patch · 3 files changed
Files
- LICENSE +1/−1
- quickcheck-io.cabal +17/−9
- src/Test/QuickCheck/IO.hs +18/−5
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2013 Simon Hengel <sol@typeful.net>+Copyright (c) 2013-2017 Simon Hengel <sol@typeful.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
quickcheck-io.cabal view
@@ -1,29 +1,37 @@+-- This file has been generated from package.yaml by hpack version 0.18.0.+--+-- see: https://github.com/sol/hpack+ name: quickcheck-io-version: 0.1.1+version: 0.2.0 synopsis: Use HUnit assertions as QuickCheck properties description: This package provides an orphan instance that allows you to use HUnit assertions as QuickCheck properties. category: Testing+homepage: https://github.com/hspec/quickcheck-io#readme+bug-reports: https://github.com/hspec/quickcheck-io/issues license: MIT license-file: LICENSE-copyright: (c) 2013 Simon Hengel+copyright: (c) 2013-2017 Simon Hengel author: Simon Hengel <sol@typeful.net> maintainer: Simon Hengel <sol@typeful.net> build-type: Simple-cabal-version: >= 1.8+cabal-version: >= 1.10 source-repository head type: git- location: https://github.com/sol/quickcheck-io+ location: https://github.com/hspec/quickcheck-io library- ghc-options:- -Wall hs-source-dirs: src- exposed-modules:- Test.QuickCheck.IO+ ghc-options: -Wall build-depends:- QuickCheck >= 2.5.1+ QuickCheck >= 2.7 , HUnit >= 1.2.5 , base == 4.*+ exposed-modules:+ Test.QuickCheck.IO+ other-modules:+ Paths_quickcheck_io+ default-language: Haskell2010
src/Test/QuickCheck/IO.hs view
@@ -1,19 +1,32 @@-{-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.IO where import qualified Control.Exception as E-import Test.HUnit.Lang (Assertion, HUnitFailure(..))+import Test.HUnit.Lang import Test.QuickCheck.Property instance Testable Assertion where property = propertyIO+#if !MIN_VERSION_QuickCheck(2,9,0) exhaustive _ = True+#endif propertyIO :: Assertion -> Property-#if MIN_VERSION_QuickCheck(2,7,0) propertyIO action = ioProperty $ do+ (action >> return succeeded) `E.catch` \ e ->+ return failed {theException = Just (E.toException e), reason = formatAssertion e}+ where+ formatAssertion e = case e of+#if MIN_VERSION_HUnit(1,3,0)+ HUnitFailure _ err -> #else-propertyIO action = morallyDubiousIOProperty $ do+ HUnitFailure err -> #endif- (action >> return succeeded) `E.catch` \(HUnitFailure err) -> return failed {reason = err}+#if MIN_VERSION_HUnit(1,5,0)+ formatFailureReason err+#else+ err+#endif