I have a simple TestInstance
in a detailed-0.9 test suite:
tests :: IO [Test]
tests = return [Test testInstance]
testInstance :: TestInstance
testInstance =
TestInstance
{ run = ioProgress,
name = "test 1",
tags = [],
options = [],
setOption = \_ _ -> Left ""
}
ioProgress :: IO Progress
ioProgress = progress 3
where
progress :: Int -> IO Progress
progress 0 = return (Finished (Fail "failed"))
progress n = return (Progress ("n == " ++ show n) (progress (n - 1)))
I thought that maybe I would see some output like
n == 3
n == 2
n == 1
whilst the test runs but I never see these strings, even with --test-show-details=always
and --test-show-details=streaming
.
The String
in the Progress
constructor doesn't appear to be used for anything. (I was able to build the Cabal
package from source after replacing it with an Int
, for example.)
The code that implements testing for detailed-0.9
is in Distribution.Simple.Test.LibV09
, and it just keeps unwrapping Progress
constructors (ignoring the String
field) until it finds a Finished
:
stubRunTests tests = do
...
where
finish (Finished result) =
return
TestLog
{ testName = name t
, testOptionsReturned = defaultOptions t
, testResult = result
}
finish (Progress _ next) = next >>= finish
...