The microspec package

[Tags:bsd3, library]

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

Properties

Versions 0.1.0.0
Dependencies base (<5), QuickCheck [details]
License BSD3
Author Tom Murphy
Maintainer Tom Murphy
Category Test, Testing
Uploaded Mon Sep 5 18:44:00 UTC 2016 by TomMurphy
Distributions NixOS:0.1.0.0
Downloads 70 total (9 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-09-05 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees