microspec: Tiny QuickCheck test library with minimal dependencies

[ bsd3, library, test, testing ] [ Propose Tags ]

A tiny (1 module, <500 lines) property-based (and unit) testing library with minimal dependencies.

Don't add a bunch of transitive dependencies just to test your code!

Instead of reinventing the wheel (https://xkcd.com/927), we use a RSpec/HSpec-like API and run tests with QuickCheck.

import Test.Microspec

main :: IO ()
main = microspec $ do
   describe "replicate" $ do
      it "doubles with 2" $
         replicate 2 'x' == "xx"
      it "creates a list of the right size" $
         \(Positive n) -> length (replicate n 'x') == n

   describe "reverse" $ do
      it "reverse . reverse == id" $ \l ->
         reverse (reverse l) == (l :: [Int])

   describe "tail" $
      it "length is -1" $ \(NonEmpty l) ->
         length (tail l :: [Int]) == length l - 1

   describe "solve the halting problem" $
Versions [faq],,,,,, (info)
Dependencies base (<5), QuickCheck (<2.12) [details]
License BSD-3-Clause
Author Tom Murphy
Maintainer Tom Murphy
Revised Revision 1 made by TomMurphy at 2018-09-12T04:37:02Z
Category Test, Testing
Uploaded by TomMurphy at 2016-09-05T18:44:00Z
Distributions Arch:, LTSHaskell:, NixOS:, Stackage:
Downloads 2600 total (44 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2016-09-05 [all 1 reports]




Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees