cabal-test-quickcheck 0.1.0 → 0.1.1
raw patch · 4 files changed
+55/−5 lines, 4 filesdep +cabal-test-quickcheckdep ~Cabaldep ~base
Dependencies added: cabal-test-quickcheck
Dependency ranges changed: Cabal, base
Files
- cabal-test-quickcheck.cabal +13/−1
- dist/build/exampleStub/exampleStub-tmp/exampleStub.hs +5/−0
- src/Distribution/TestSuite/QuickCheck.hs +11/−4
- test/Example.hs +26/−0
cabal-test-quickcheck.cabal view
@@ -1,5 +1,5 @@ name: cabal-test-quickcheck-version: 0.1.0+version: 0.1.1 homepage: https://github.com/zimothy/cabal-test-quickcheck license: MIT license-file: LICENSE@@ -26,6 +26,18 @@ base >= 4.6.0 && < 4.7, Cabal >= 1.16.0 && < 1.19, QuickCheck >= 2.6 && < 2.7++test-suite example+ type: detailed-0.9+ test-module: Example++ hs-source-dirs: test+ default-language: Haskell2010++ build-depends:+ base >= 4.6 && < 4.7,+ Cabal >= 1.16 && < 1.19,+ cabal-test-quickcheck source-repository head type: git
+ dist/build/exampleStub/exampleStub-tmp/exampleStub.hs view
@@ -0,0 +1,5 @@+module Main ( main ) where+import Distribution.Simple.Test ( stubMain )+import Example ( tests )+main :: IO ()+main = stubMain tests
src/Distribution/TestSuite/QuickCheck.hs view
@@ -14,9 +14,10 @@ ) where -------------------------------------------------------------------------------import Control.Applicative ((<$>), (<|>))-import Control.Monad (foldM)-import Data.Maybe (catMaybes)+import Control.Applicative ((<$>), (<|>))+import Control.Monad (foldM)+import Data.List (isSuffixOf, stripPrefix)+import Data.Maybe (catMaybes, fromMaybe) import Distribution.TestSuite hiding (Result) import Test.QuickCheck @@ -120,8 +121,14 @@ toProgress result = Finished $ case result of Success {} -> Pass GaveUp {} -> Fail "Gave up"- Failure { reason } -> Fail reason+ Failure { output } -> Fail $ tidyFail output NoExpectedFailure {} -> Fail "Expected failure when none occurred"++tidyFail :: String -> String+tidyFail output+ | ": \n" `isSuffixOf` suff = take (length suff - 3) suff+ | otherwise = filter (/= '\n') suff+ where suff = fromMaybe output $ stripPrefix "*** Failed! " output ------------------------------------------------------------------------------
+ test/Example.hs view
@@ -0,0 +1,26 @@+------------------------------------------------------------------------------+module Example (tests) where++------------------------------------------------------------------------------+import Distribution.TestSuite.QuickCheck+++------------------------------------------------------------------------------+tests :: IO [Test]+tests = return+ [ testProperty "Succeeds" True+ , testProperty "Fails" False+ , testGroup "May fail" mayFail+ ]+++------------------------------------------------------------------------------+mayFail :: [Test]+mayFail =+ [ testProperty "Maybe fails" neqNegation+ , testProperty "Probably fails" $ not . neqNegation+ ]++neqNegation :: Int -> Bool+neqNegation x = x /= -x+