microspec

Tiny QuickCheck test library with minimal dependencies

LTS Haskell 22.39:0.2.1.3
Stackage Nightly 2024-10-30: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
This version can be pinned in stack with:microspec-0.2.1.3@sha256:85769492d4e0d694bbfc22bea41a4c57a35a99518c822e85360da1d44f61fb41,1694

Module documentation for 0.2.1.3

Depends on 3 packages(full list with versions):

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

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

For many use-cases, microspec is a drop-in replacement for hspec.

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