easytest: Simple, expressive testing library
This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.
EasyTest is a simple testing toolkit for unit- and property-testing. It's based on the hedgehog property-testing system. Here's an example usage:
module Main where
import EasyTest
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
suite :: Test
suite = tests
[ scope "addition.ex1" $ unitTest $ 1 + 1 === 2
, scope "addition.ex2" $ unitTest $ 2 + 3 === 5
, scope "list.reversal" $ property $ do
ns <- forAll $
Gen.list (Range.singleton 10) (Gen.int Range.constantBounded)
reverse (reverse ns) === ns
-- equivalent to `scope "addition.ex3"`
, scope "addition" . scope "ex3" $ unitTest $ 3 + 3 === 6
, scope "always passes" $ unitTest success -- record 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 :: IO Summary
main = runOnly "addition" suiteThis generates the output:
━━━ runOnly "addition" ━━━ ✓ addition.ex1 passed 1 test. ✓ addition.ex2 passed 1 test. ⚐ list.reversal gave up after 1 discard, passed 0 tests. ✓ addition.ex3 passed 1 test. ⚐ always passes gave up after 1 discard, passed 0 tests. ⚐ failing test gave up after 1 discard, passed 0 tests. ⚐ 3 gave up, 3 succeeded.
We write tests with ordinary Haskell code, with control flow explicit and under programmer control.
Properties
| Versions | 0.1, 0.1.1, 0.2, 0.2.1, 0.3, 0.3 |
|---|---|
| Change log | CHANGES.md |
| Dependencies | base (>=4.5 && <=5), call-stack (>=0.1), hedgehog (>=0.6 && <=0.6.1), mtl, profunctors, semigroups (>=0.18 && <0.19), split (>=0.2.3), stm, tagged, transformers [details] |
| License | MIT |
| Copyright | Copyright (C) 2017-2019 Joel Burget, Copyright (C) 2016 Paul Chiusano and contributors |
| Author | Joel Burget, Paul Chiusano |
| Maintainer | Joel Burget <joelburget@gmail.com> |
| 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 2019-03-06T19:42:22Z |
Modules
[Index] [Quick Jump]
Downloads
- easytest-0.3.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees