microspec: Tiny QuickCheck test library with minimal dependencies

[ bsd3, library, test, testing ] [ Propose Tags ] [ Report a vulnerability ]

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

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.1.0, 0.2.1.1, 0.2.1.2, 0.2.1.3 (info)
Dependencies base (<5), QuickCheck, time [details]
License BSD-3-Clause
Author Tom Murphy
Maintainer Tom Murphy
Category Test, Testing
Uploaded by TomMurphy at 2018-11-10T20:10:25Z
Distributions Arch:0.2.1.3, Debian:0.2.1.3, LTSHaskell:0.2.1.3, NixOS:0.2.1.3, Stackage:0.2.1.3
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4483 total (43 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-11-10 [all 1 reports]