Tiny QuickCheck test library with minimal dependencies

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD3 licensed and maintained by Tom Murphy

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" $
Depends on:
Used by 1 package:
comments powered byDisqus