hspec-checkers (empty) → 0.1.0
raw patch · 7 files changed
+125/−0 lines, 7 filesdep +basedep +checkersdep +hspecsetup-changed
Dependencies added: base, checkers, hspec
Files
- LICENSE +30/−0
- README.md +4/−0
- Setup.hs +2/−0
- default.nix +8/−0
- hspec-checkers.cabal +44/−0
- src/Test/Hspec/Checkers.hs +36/−0
- test/Spec.hs +1/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Zalora South East Asia Pte Ltd++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Sönke Hahn nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,4 @@+hspec-checkers+==============++Allows to use checkers properties from hspec
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ default.nix view
@@ -0,0 +1,8 @@+{ pkgs ? import <nixpkgs> { }+, src ? builtins.filterSource (path: type:+ type != "unknown" &&+ baseNameOf path != ".git" &&+ baseNameOf path != "result" &&+ baseNameOf path != "dist") ./.+}:+pkgs.haskellPackages.buildLocalCabal src "hspec-checkers"
+ hspec-checkers.cabal view
@@ -0,0 +1,44 @@+name: hspec-checkers+version: 0.1.0+synopsis: Allows to use checkers properties from hspec+description:+ Allows to use <http://hackage.haskell.org/package/checkers checkers>+ properties from <http://hackage.haskell.org/package/hspec hspec>.+license: BSD3+license-file: LICENSE+author: Sönke Hahn+maintainer: soenke.hahn@zalora.com+copyright: Zalora South East Asia Pte Ltd+category: Testing+build-type: Simple+cabal-version: >=1.10+extra-source-files:+ README.md+ default.nix++source-repository head+ type: git+ location: https://github.com/zalora/hspec-checkers++library+ exposed-modules: Test.Hspec.Checkers+ build-depends:+ base == 4.*,+ hspec,+ checkers+ hs-source-dirs: src+ default-language: Haskell2010+ ghc-options:+ -Wall -fno-warn-name-shadowing++test-suite spec+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ hs-source-dirs: src, test+ main-is: Spec.hs+ build-depends:+ base == 4.*,+ hspec,+ checkers+ ghc-options:+ -Wall -fno-warn-name-shadowing
+ src/Test/Hspec/Checkers.hs view
@@ -0,0 +1,36 @@+{-# OPTIONS_GHC -fno-warn-unused-imports #-}++-- | This module bridges between+-- <http://hackage.haskell.org/package/checkers checkers> and+-- <http://hackage.haskell.org/package/hspec hspec>. It makes it easy to+-- integrate tests for class laws provided by checkers into test suites written+-- with hspec.+--+-- Here's an example testing that lists satisfy the 'Monoid' laws:+--+-- @+--import Test.Hspec -- 'Test.Hspec'+--import Test.Hspec.Checkers -- 'Test.Hspec.Checkers'+--import Test.QuickCheck.Classes -- 'Test.QuickCheck.Classes'+--+--main :: IO ()+--main = 'hspec' spec+--+--spec :: Spec+--spec = do+-- 'testBatch' ('monoid' (undefined :: [Int]))+-- @+module Test.Hspec.Checkers (testBatch) where+++import Test.Hspec+import Test.QuickCheck.Checkers++-- to make haddock links work+import Test.QuickCheck.Classes (monoid)+++-- | Allows to insert a 'TestBatch' into a Spec.+testBatch :: TestBatch -> Spec+testBatch (batchName, tests) = describe ("laws for: " ++ batchName) $+ foldr (>>) (return ()) (map (uncurry it) tests)
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}