packages feed

deepseq-bounded-0.5.0: test/Tests.hs

-- Refer to /work/Projects/MiniProjects/SybShape/tests for
-- more code in first HUnit example (which itself is still
-- just fudging it)!

{-# LANGUAGE CPP #-}

-------------------------------------------------------------------------------

  module Tests ( tests, main_tests ) where

-------------------------------------------------------------------------------

  import Test.HUnit

  import System.IO.Unsafe ( unsafePerformIO )

#if HASKELL98_FRAGMENT
  import qualified Blah98 as Blah ( run_tests )
#else
  import qualified Blah           ( run_tests )
#endif

-------------------------------------------------------------------------------

  main_tests :: IO Int
  main_tests = do
    Blah.run_tests
    return 0

-------------------------------------------------------------------------------

-- XXX A better way to "fail on purpose" is to have the test
-- return ExitFailure, no?...
--tests = (unsafePerformIO main_tests == output) ~? "FAILING ON PURPOSE TO DISPLAY THE LOGGED OUTPUT!"  -- yeah but it wasn't printed
  tests = unsafePerformIO
            ( do n <- main_tests
                 putStrLn "FAILING ON PURPOSE TO DISPLAY THE LOGGED OUTPUT!\n"
                 return n )
            ~=? output
  output = 1::Int  -- force test to fail! (so we see the output!)
--output = 0::Int
--output = ()

-------------------------------------------------------------------------------