easytest: Simple, expressive testing library
EasyTest is a simple testing toolkit, meant to replace most uses of QuickCheck, SmallCheck, HUnit, and frameworks like Tasty, etc. Here's an example usage:
module Main where import EasyTest import Control.Applicative import Control.Monad suite :: Test () suite = tests [ scope "addition.ex1" $ expect (1 + 1 == 2) , scope "addition.ex2" $ expect (2 + 3 == 5) , scope "list.reversal" . fork $ do -- generate lists from size 0 to 10, of Ints in (0,43) -- shorthand: listsOf [0..10] (int' 0 43) ns <- [0..10] `forM` \n -> replicateM n (int' 0 43) ns `forM_` \ns -> expect (reverse (reverse ns) == ns) -- equivalent to `scope "addition.ex3"` , scope "addition" . scope "ex3" $ expect (3 + 3 == 6) , scope "always passes" $ do note "I'm running this test, even though it always passes!" ok -- like `pure ()`, but records a success result , scope "failing test" $ crash "oh noes!!" ] -- NB: `run suite` would run all tests, but we only run -- tests whose scopes are prefixed by "addition" main = runOnly "addition" suite
This generates the output:
Randomness seed for this run is 5104092164859451056 Raw test output to follow ... ------------------------------------------------------------ OK addition.ex1 OK addition.ex2 OK addition.ex3 ------------------------------------------------------------ ✅ 3 tests passed, no failures! 👍 🎉
The idea here is to write tests with ordinary Haskell code, with control flow explicit and under programmer control.
Flags
Manual Flags
Name | Description | Default |
---|---|---|
optimized | Disabled | |
quiet | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- easytest-0.2.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 0.1, 0.1.1, 0.2, 0.2.1, 0.3 |
---|---|
Change log | CHANGES.md |
Dependencies | async (>=2.1 && <=2.3), base (>=4.8 && <4.12), call-stack (>=0.1), containers (>=0.4.0 && <0.6), mtl (>=2.0.1 && <2.3), random (>=1.1 && <2), semigroups (>=0.18 && <0.19), stm (>=2.4 && <3), text (>=1.2 && <1.3), transformers (>=0.4.2) [details] |
Tested with | ghc ==7.10.3, ghc ==8.0.2, ghc ==8.2.1, ghc ==8.4.1 |
License | MIT |
Copyright | Copyright (C) 2017-2018 Joel Burget, Copyright (C) 2016 Paul Chiusano and contributors |
Author | Joel Burget, Paul Chiusano |
Maintainer | Joel Burget <joelburget@gmail.com> |
Revised | Revision 1 made by GeorgeWilson at 2018-10-24T02:31:12Z |
Category | Testing |
Home page | https://github.com/joelburget/easytest |
Bug tracker | https://github.com/joelburget/easytest/issues |
Source repo | head: git clone git@github.com:joelburget/easytest.git |
Uploaded | by joelb at 2018-03-27T22:38:49Z |
Distributions | Debian:0.2.1 |
Reverse Dependencies | 2 direct, 7 indirect [details] |
Downloads | 3894 total (20 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2018-03-27 [all 1 reports] |