Skip to content

Commit

Permalink
Weaken Cabal bounds, remove example test-suite
Browse files Browse the repository at this point in the history
The lower bound on Cabal was unnecessary and has been relaxed. The
example test-suite, which includes failures, has been removed so that
the project does not appear to be failing its tests. The Example module
is still available, now with some extra documentation, and the readme
has been updated to include the relevant information that should be in a
Cabal file.  The source has also been tidied by stylish-haskell.
  • Loading branch information
zmthy committed Feb 20, 2015
1 parent a786efd commit 4c2b2e3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 32 deletions.
4 changes: 0 additions & 4 deletions README

This file was deleted.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cabal-test-quickcheck
=====================

Support for QuickCheck with the 'detailed' Cabal testing interface. See
`test/Example.hs` for an example of use.

Set the `type` of your test-suite to `detailed-0.9`, and point the `test-module`
field to the module which exports your `tests`. Configure with the
`--enable-tests` option and run `cabal test`.
16 changes: 1 addition & 15 deletions cabal-test-quickcheck.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cabal-test-quickcheck
version: 0.1.3
version: 0.1.4
license: MIT
license-file: LICENSE
author: Timothy Jones
Expand Down Expand Up @@ -28,20 +28,6 @@ library
Cabal >= 1.16 && < 1.23,
QuickCheck >= 2.6 && < 2.8

test-suite example
type: detailed-0.9
test-module: Example

hs-source-dirs: test
default-language: Haskell2010

ghc-options: -Wall -Werror

build-depends:
base >= 4.6 && < 4.8,
Cabal >= 1.19 && < 1.23,
cabal-test-quickcheck

source-repository head
type: git
location: git://github.com/zmthy/cabal-test-quickcheck.git
13 changes: 6 additions & 7 deletions src/Distribution/TestSuite/QuickCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ module Distribution.TestSuite.QuickCheck
, testGroup
) where

------------------------------------------------------------------------------
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
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


------------------------------------------------------------------------------
Expand Down
15 changes: 9 additions & 6 deletions test/Example.hs
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
------------------------------------------------------------------------------
-- | An example testing module for cabal-test-quickcheck. The `test-module` of
-- a test-suite must export a 'tests' definition.
module Example (tests) where

------------------------------------------------------------------------------
import Distribution.TestSuite.QuickCheck
import Distribution.TestSuite.QuickCheck


------------------------------------------------------------------------------
-- | The root definition of the tests. Must be of type 'IO [Test]'.
tests :: IO [Test]
tests = return
[ testProperty "Succeeds" True
, testProperty "Fails" False
, testGroup "May fail" mayFail
, mayFail
]


------------------------------------------------------------------------------
mayFail :: [Test]
mayFail =
-- | A list of tests can be grouped together into a single test.
mayFail :: Test
mayFail = testGroup "May fail"
[ testProperty "Maybe fails" neqNegation
, testProperty "Probably fails" $ not . neqNegation
, testProperty "Probably fails" (not . neqNegation)
]

neqNegation :: Int -> Bool
Expand Down

0 comments on commit 4c2b2e3

Please sign in to comment.