You can run individual spec items that match a given pattern by passing
--match PATTERN
to your test driver. The PATTERN
is matched against
/
-separated path of the spec itemTo understand what exactly this means let's look at an example.
runhaskell Spec.hs Prelude reverse reverses a list [✘] show shows its argument [✔] Failures: Spec.hs:8:7: 1) Prelude.reverse reverses a list To rerun use: --match "/Prelude/reverse/reverses a list/" Randomized with seed 921447365 Finished in 0.0005 seconds 2 examples, 1 failure
This spec contains one failing spec item.
The /
-separated path of that spec item is:
Prelude/reverse/reverses a list
The pretty-printed path as it appears in the test output is:
Prelude.reverse reverses a list
You can rerun the failing spec item by either matching on the /
-separated
path or the pretty-printed path. Both of the following options lead to the
same result:
runhaskell Spec.hs -m "Prelude/reverse/reverses a list"
runhaskell Spec.hs -m "Prelude.reverse reverses a list"
Or you can match on any substring of one of the above, e.g.:
runhaskell Spec.hs -m reverse
Note: Do not rely on the pretty-printed path for scripting purpose; use the /
-separated path instead!