chell: A quiet test runner for Haskell

Code: https://john-millikin.com/code/chell (GitHub mirror)

History

Back in 2011 or so, the most popular Haskell test frameworks generated a lot of status output but relatively little info about why tests failed. I wrote Chell so my tests would be quiet if they passed, and give to-the-line error info on failure.

It hasn't seen much development effort the past few years, and its integrations with other test tools such as QuickCheck probably don't build any more.

Assertions

Chell has a small selection of built-in assertions, which cover most simple testing requirements. Use the $assert or $expect functions to run assertions. See the Chell API documentation for full type signatures.

{-# LANGUAGE TemplateHaskell #-}

import Test.Chell

tests :: Suite
tests = suite "tests"
	test_Numbers
	test_Text

test_Numbers :: Test
test_Numbers = assertions "numbers" $ do
	$assert (equal 1 1)
	$assert (greater 2 1)
	$assert (equalWithin 1.0001 1.0 0.01)

test_Text :: Test
test_Text = assertions "text" $ do
	let str1 = "foo\nbar\nbaz"
	let str2 = "foo\nbar\nqux"
	
	$assert (equalLines str1 str2)

main :: IO ()
main = defaultMain [tests]

QuickCheck

Chell also supports running QuickCheck properties, via the chell-quickcheck package.

import Test.Chell
import Test.Chell.QuickCheck

tests :: Suite
tests = suite "tests"
	test_Equality
	test_Increment

test_Equality :: Test
test_Equality = property "equality" (\x -> x == x)

test_Increment :: Test
test_Increment = property "equality" (\x -> x + 1 > x)

main :: IO ()
main = defaultMain [tests]
Change Feed