microspec

Tiny QuickCheck test library with minimal dependencies

Version on this page:0.1.0.0
LTS Haskell 15.15:0.2.1.3
Stackage Nightly 2020-06-04:0.2.1.3
Latest on Hackage:0.2.1.3

See all snapshots microspec appears in

BSD-3-Clause licensed and maintained by Tom Murphy

Module documentation for 0.1.0.0

This version can be pinned in stack with:[email protected]:c533078b566139baef4aa77949f80bcc4a2753813707774fa586d923ff59b5be,1681

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" $
      pending
Depends on 2 packages(full list with versions):