How can I set up a simple test with Cabal?

As Duncan mentioned in Greg’s answer, Cabal-1.10 has support for test suites out of the box.

The manual seems to have the best information that’s I’ve found regarding how to make use of this.

Here’s a snippet from the manual which shows how to use the exitcode-stdio test type:

foo.cabal

Name:           foo
Version:        1.0
License:        BSD3
Cabal-Version:  >= 1.9.2
Build-Type:     Simple

Test-Suite test-foo
    type:       exitcode-stdio-1.0
    main-is:    test-foo.hs
    build-depends: base

test-foo.hs:

module Main where

import System.Exit (exitFailure)

main = do
    putStrLn "This test always fails!"
    exitFailure

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)