8000 GitHub - pbrisbin/cabal-test-hunit: Interface to run HUnit tests via Cabal 1.16
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pbrisbin/cabal-test-hunit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cabal-test-hunit

Interface for running HUnit tests via Cabal 1.16.

DEPRECATED: I no longer use this, and very much prefer HSpec. Therefore:

  • You will see no active development here, though I'm happy to merge PRs
  • I will not be publishing this to Hackage, though I'd be fine with someone else doing so

Installation

git clone ... && cd ... && cabal install

Usage

Add a suite to your cabal file:

Test-Suite test-your-thing
    type:          detailed-0.9
    test-module:   Test.YourTestModule
    b
671F
uild-depends: base
                 , Cabal
                 , HUnit
                 , cabal-test-hunit

Write some tests in Test.YourTestModule:

import Test.HUnit

import qualified Distribution.TestSuite as C
import qualified Distribution.TestSuite.HUnit as H

tests :: IO [C.Test]
tests = return $ map (uncurry H.test) testCases

testCases :: [(String, Test)]
testCases = [("Truth tests", truthTest)]

truthTest :: Test
truthTest = TestCase $ assertEqual "True is true" True True

Run them:

cabal configure --enable-tests
cabal build
cabal test

Prior work

An early version of this module, written by Thomas Tuegel in 2010, can be found in this darcs repo.

This file shares no code with that one, as the changes in Cabal 1.16 required it be entirely rewritten. I've retained Thomas' LICENSE but removed his copyright; I hope that's appropriate.

About

Interface to run HUnit tests via Cabal 1.16

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

0