Skip to content

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

@dmwit

Description

@dmwit

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions