guard-haskell

Gem Version Build Status Dependencies Status

Guard::Haskell automatically runs your specs

Install

% cabal install hspec
% gem install guard-haskell

Usage

How does it work?

For explanation what guard is and how to use it, please refer to the guard manual

guard-haskell uses hspec to run specs and check their success, so it makes some assumptions about your code style:

  • hspec is your testing framework and

  • hspec-discover (or similar tool) organizes your specs, i.e. there is a "top" spec (usually test/Spec.hs) that pulls others in

When you type in guard, guard-haskell fires up an ghci instance which it talks to, reloading and rerunning (parts of) "top" spec on files modifications.

Guardfile examples

Typical haskell project:

guard :haskell do
  watch(%r{test/.+Spec\.l?hs$})
  watch(%r{src/.+\.l?hs$})
end

Customized haskell project:

guard :haskell, all_on_pass: true, ghci_options: ["-DTEST"] do
  watch(%r{test/.+Spec\.l?hs$})
  watch(%r{lib/.+\.l?hs$})
  watch(%r{bin/.+\.l?hs$})
end

Options

Guard::Haskell has a bunch of options:

all_on_start

Run all specs on start (default: false).

all_on_pass

Run all specs after previously failing spec finally passes (default: false).

ghci_options

Pass custom ghci options, for example, -XCPP directives like -DTEST (default: []).

top_spec

"Top" spec location (default: test/Spec.hs).