Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Export optionsDescription #27

merged 1 commit into from

2 participants


Hi Max,

I would like to use test-framework in a test suite where I need to specify some additional command line arguments. Moreover, I would like to use cmdtheline to handle the command line processing.

I've written a patch for cmdtheline that provides an adapter for a list of OptDescrs.

If test-framework would export it's options then I can use both packages together like in the following:

import Data.Functor                     ( (<$>) )
import Data.Maybe                       ( catMaybes )
import Data.Monoid                      ( mconcat )
import System.Console.CmdTheLine        ( Term, run, defTI )
import System.Console.CmdTheLine.GetOpt ( optDescrsTerm )
import Test.Framework                   ( defaultMainWithOpts, optionsDescription )

main :: IO ()
main = run (term, defTI)

term :: Term (IO ())
term = defaultMainWithOpts [] . mconcat . catMaybes <$>
         optDescrsTerm optionsDescription

Running it:

$ ./test --help

       b, [OPTION]...

       --maximum-generated-tests=NUMBER, -a NUMBER
           how many automated tests something like QuickCheck should try, by

       --maximum-test-depth=NUMBER, -d NUMBER
           to what depth something like SmallCheck should test the properties,
           by default

       --threads=NUMBER, -j NUMBER
           number of threads to use to run tests

       --list-tests, -l
           list available tests but don't run any; useful to guide subsequent

       --timeout=NUMBER, -o NUMBER
           how many seconds a test should be run for before giving up, by

       --maximum-test-size=NUMBER, -s NUMBER
           to what size something like QuickCheck should test the properties,
           by default

       --select-tests=TEST-PATTERN, -t TEST-PATTERN
           only tests that match at least one glob pattern given by an
           instance of this argument will be run

           use ANSI terminal features to display the test run

           show this help message

       --help[=FMT] (default=pager)
           Show this help in format FMT (pager, plain, or groff).

           hide sucessful tests, and only show failures

           write a JUnit XML summary of the output to FILE

           use nested testsuites to represent groups in JUnit XML (not
           standards compliant)

           how many unsuitable candidate tests something like QuickCheck
           should endure before giving up, by default

           specifies that tests should be run without a timeout, by default

           do not use any ANSI terminal features to display the test run

           default seed for test random number generator
@batterseapower batterseapower merged commit c896812 into batterseapower:master

Looks fine to me! Released as v0.6.2



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 16, 2012
  1. @basvandijk

    Export optionsDescription

    basvandijk authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  core/Test/Framework/Runners/Console.hs
2  core/Test/Framework/Runners/Console.hs
@@ -1,6 +1,6 @@
module Test.Framework.Runners.Console (
defaultMain, defaultMainWithArgs, defaultMainWithOpts,
- interpretArgs, interpretArgsOrExit
+ optionsDescription, interpretArgs, interpretArgsOrExit
) where
import Test.Framework.Core
Something went wrong with that request. Please try again.