diff --git a/README b/README deleted file mode 100644 index b9bf49d..0000000 --- a/README +++ /dev/null @@ -1,4 +0,0 @@ -Support for QuickCheck with the 'detailed' Cabal testing interface. - -See `test/Example.hs` and the test-suite in the Cabal file for an example of -use. Configure with the `--enable-tests` option and run `cabal test`. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9c50f3c --- /dev/null +++ b/README.md @@ -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`. diff --git a/cabal-test-quickcheck.cabal b/cabal-test-quickcheck.cabal index 9091785..9378a19 100644 --- a/cabal-test-quickcheck.cabal +++ b/cabal-test-quickcheck.cabal @@ -1,5 +1,5 @@ name: cabal-test-quickcheck -version: 0.1.3 +version: 0.1.4 license: MIT license-file: LICENSE author: Timothy Jones @@ -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 diff --git a/src/Distribution/TestSuite/QuickCheck.hs b/src/Distribution/TestSuite/QuickCheck.hs index a9b5ca0..30c5af7 100644 --- a/src/Distribution/TestSuite/QuickCheck.hs +++ b/src/Distribution/TestSuite/QuickCheck.hs @@ -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 ------------------------------------------------------------------------------ diff --git a/test/Example.hs b/test/Example.hs index b41b46f..3921cbb 100644 --- a/test/Example.hs +++ b/test/Example.hs @@ -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