hspec-leancheck: LeanCheck support for the Hspec test framework.

[ bsd3, library, testing ] [ Propose Tags ] [ Report a vulnerability ]

LeanCheck support for the Hspec test framework.

This package can be used to incorporate LeanCheck tests into Hspec test suites.

Please see the Haddock documentation and README for more details.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.6
Change log changelog.md
Dependencies base (>=4 && <5), hspec (>=2.5), hspec-core, HUnit, leancheck (>=0.9.3) [details]
Tested with ghc ==9.0, ghc ==8.10, ghc ==8.8, ghc ==8.6, ghc ==8.4, ghc ==8.2, ghc ==8.0, ghc ==7.10, ghc ==7.8
License BSD-3-Clause
Author Rudy Matela <rudy@matela.com.br>
Maintainer Rudy Matela <rudy@matela.com.br>
Category Testing
Home page https://github.com/rudymatela/hspec-leancheck#readme
Source repo head: git clone https://github.com/rudymatela/hspec-leancheck
this: git clone https://github.com/rudymatela/hspec-leancheck(tag v0.0.6)
Uploaded by rudymatela at 2021-06-15T00:16:16Z
Distributions LTSHaskell:0.0.6, NixOS:0.0.6, Stackage:0.0.6
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2435 total (8 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-06-15 [all 1 reports]

Readme for hspec-leancheck-0.0.6

[back to package description]

hspec-leancheck: LeanCheck support for Hspec

hspec-leancheck's Build Status hspec-leancheck on Hackage hspec-leancheck on Stackage LTS hspec-leancheck on Stackage Nightly

LeanCheck support for the Hspec test framework.

Installing

$ cabal install hspec-leancheck

Example

Here's how your spec.hs might look like:

import Test.Hspec
import Test.Hspec.LeanCheck as LC

import Data.List (sort)

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "sort" $ do
    it "is idempotent" $
      LC.property $ \xs -> sort (sort xs :: [Int]) == sort xs
    it "is identity" $ -- not really
      LC.property $ \xs -> sort (xs :: [Int]) == xs

And here is the output for the above program:

$ ./eg/minimal

sort
  is idempotent
  is identity FAILED [1]

Failures:

  eg/minimal.hs:17:5: 
  1) sort is identity
       [1,0]

  To rerun use: --match "/sort/is identity/"

Randomized with seed 44182769

Finished in 0.0008 seconds
2 examples, 1 failure

Options

Use propertyWith to configure the number of tests.

Further reading