Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print something, even before the test result is known #9

Open
dmwit opened this issue Jan 22, 2015 · 1 comment
Open

print something, even before the test result is known #9

dmwit opened this issue Jan 22, 2015 · 1 comment

Comments

@dmwit
Copy link

dmwit commented Jan 22, 2015

For long-running tests, it is convenient to learn which test is running even before one knows any results of the test. The console runner does not print anything until the full result is known. The following code demonstrates this:

{-# LANGUAGE MultiParamTypeClasses #-}

import Control.Concurrent
import Control.Monad
import Data.Typeable
import System.IO.Unsafe
import Test.Framework.Runners.Console
import Test.Framework.Providers.API

instance TestResultlike () Bool where testSucceeded = id
instance Testlike       () Bool (IO a) where
  runTest _ act = do
    v <- unsafeInterleaveIO act
    return (Improving () (v `seq` Finished True), return ())
  testTypeName _ = "IO action"

main = defaultMain [Test "infinity" (forever (threadDelay 1000000) >> return ())]

When I run this program, I would like to see at least:

infinity:

but instead see no output.

@glguy
Copy link
Member

glguy commented Sep 9, 2015

Implementing this will require some cleverness. The test runner appears to run tests concurrently, so to do this well I think you'd want either an alternate runner that separately prints when a test has started running and when it is finished (along with the outcome) or some clever console code to Show which tests are running and then dance the cursor around to fill in the outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants