hcltest: A testing library for command line applications.

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] [Publish]

Allows to write tests for command line applications using haskell.


[Skip to Readme]

Properties

Versions 0.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 log None available
Dependencies base (>=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 && <2.5), 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]
License BSD-3-Clause
Copyright Copyright (C) 2013-2015 Benno Fünfstück
Author Benno Fünfstück
Maintainer Benno Fünfstück <benno.fuenfstueck@gmail.com>
Category Testing
Home page http://github.com/bennofs/hcltest/
Bug tracker http://github.com/bennofs/hcltest/issues
Source repo head: git clone git://github.com/bennofs/hcltest.git
Uploaded by BennoFuenfstueck at 2015-09-28T19:58:47Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hcltest-0.3.8

[back to package description]

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.