The hcltest package

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.

[maintain]

Allows to write tests for command line applications using haskell.


[Skip to ReadMe]

Properties

Versions0.1, 0.2, 0.3, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8
Change logNone available
Dependenciesbase (>=4.5.1.0 && <4.9), bytestring (>=0.9.2.1 && <0.11), directory (>=1.1.0.2 && <1.3), dlist (>=0.6.0.1 && <0.8), either (>=4.1.1 && <4.5), filepath (>=1.3.0.0 && <1.5), free (>=4.5 && <4.13), lens (>=4.0.7 && <4.13), mmorph (>=1.0.2 && <1.1), monad-control (>=1 && <1.1), mtl (>=2.1.2 && <2.3), optparse-applicative (>=0.7.0.2 && <0.12), process (>=1.1.0.1 && <1.3), random-shuffle (>=0.0.4 && <0.1), split (>=0.2.1.1 && <0.3), stm (==2.4.*), tagged (>=0.7.1 && <0.9), tasty (>=0.8.0.2 && <0.11), temporary (>=1.2.0.1 && <1.3), text (>=0.11.2.3 && <1.3), transformers (>=0.3.0.0 && <0.5), transformers-base (>=0.4.1 && <0.5) [details]
LicenseBSD3
CopyrightCopyright (C) 2013-2015 Benno Fünfstück
AuthorBenno Fünfstück
MaintainerBenno Fünfstück <benno.fuenfstueck@gmail.com>
CategoryTesting
Home pagehttp://github.com/bennofs/hcltest/
Bug trackerhttp://github.com/bennofs/hcltest/issues
Source repositoryhead: git clone git://github.com/bennofs/hcltest.git
UploadedMon Sep 28 19:58:47 UTC 2015 by BennoFuenfstueck

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for hcltest-0.3.8

hcltest Build Status

hcltest is a library for testing command-line applications.

Usage

The library provides integration with tasty. Here's an example of a simple test using the library together with tasty:

{-# LANGUAGE OverloadedStrings #-} -- we enable OverloadedStrings because hcltest uses text
module Main where

import Test.Tasty
import Test.Tasty.HClTest -- this is the library
import System.Exit (ExitCode(ExitSuccess))

main :: IO ()
main = defaultMain $ testGroup "main"
  [ hcltest "true is successful" (testExitCode Nothing Nothing 1000 "true" [] ExitSuccess) 
  , hcltest "cat works" $ testInteractive Nothing Nothing 1000 "cat" [] $ do
      send "Hey!"
      expect Stdout "Hey!"
      return ExitSuccess
  ]

Here, we created a tasty test case with the hcltest function. The first argument of that function specifies the name of the test case. In the second argument, you can then perform hcltest actions, like testExitCode or testInterative. See the haddocks for the details of the arguments to these functions.