[Haskell-beginners] HSpec output option
Baa
aquagnu at gmail.com
Tue Sep 12 08:06:55 UTC 2017
Hello, Dear List!
I have tests: I'm using HSpec (and QuickCheck too). And I have tests
like this:
describe "Something" $ do
it "something is correct" $ do
...blah-blah...
it "any string is correct" $ property $
\s -> all (=='*') (Something s) -- it's for example only!!!
so something like unit-test and property checks in one SomethingSpec.hs.
I'm running them with this Makefile:
.PHONY: test fast-test
fast-test:
stack exec runhaskell -- -isrc -itest test/Spec.hs
test:
stack test
and in Spec.hs I have:
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
That's all. So, when I find failed test, I get a trace like this:
...
Failures:
test/SomethingSpec.hs:172:
1) BlahBlah.superFunc any string is correct:
result Gave up after 48 tests
...etc...
So, my question is: when QuichCheck runs my property test, it passes
argument to property's lambda. And on 48th test attempt with some
concreate argument value my check fails. How can I get detailed output
from such test environment, to see what concreate arguments lead to
failure? To see something (or similar/or more detailed even):
Failed with arguments: s = ""
Is it possible (I run them with stack and with runhaskell too) ?
===
Best regards, Paul
More information about the Beginners
mailing list