hunit-gui 0.1 → 0.1.1
raw patch · 3 files changed
+22/−18 lines, 3 filesbuild-type:Custom
Files
- Test/HUnit/Gui.hs +9/−2
- examples/Main.hs +11/−14
- hunit-gui.cabal +2/−2
Test/HUnit/Gui.hs view
@@ -1,4 +1,11 @@-module Test.HUnit.Gui (runTestGui, exitWhenGuiCloses)-where+-- | Graphical front-end for HUnit.+module Test.HUnit.Gui (+ -- | Test controller. Use in place of runTestTT or runTestText+ runTestGui++ -- | Optional cleanup step that ends the program with an appropriate+ -- return code when the GUI is closed.+ , exitWhenGuiCloses+ ) where import Test.HUnit.Gui.Window
examples/Main.hs view
@@ -1,6 +1,8 @@ module Main where +import Control.Concurrent+ import Test.HUnit import Test.HUnit.Gui @@ -8,19 +10,14 @@ testInfo <- runTestGui bigLongTests exitWhenGuiCloses testInfo --- First and third tests should pass; second and fourth should fail bigLongTests :: Test-bigLongTests = test [ "first" ~: 224743 ~=? (head $ drop 20000 primes)- , "second" ~: 22 ~=? (head $ drop 40000 primes)- , "third" ~: 746777 ~=? (head $ drop 60000 primes)- , "fourth" ~: 44 ~=? (head $ drop 80000 primes)+bigLongTests = test [ "long-running success" ~: fakeTest True 2000+ , "quick-running success" ~: fakeTest True 500+ , "long-running failure" ~: fakeTest False 2000+ , "quick-running failure" ~: fakeTest False 500 ]- where- odds = [3,5..] :: [Integer]- primeToList n = not . any (\p -> n `mod` p == 0)- primes =- let aux [] = []- aux ns@(p:_) =- let (knownPrimes, remaining) = span (\n -> n < p*p) ns- in knownPrimes ++ (aux $ filter (\n -> primeToList n knownPrimes) remaining)- in 2 : (aux odds)++fakeTest :: Bool -> Int -> IO ()+fakeTest success milliseconds = do+ threadDelay $ milliseconds * 1000+ assertBool "No msg" success
hunit-gui.cabal view
@@ -1,12 +1,12 @@ Name: hunit-gui-Version: 0.1+Version: 0.1.1 Cabal-Version: >= 1.6 License: PublicDomain Author: Kim Wallmark Homepage: http://patch-tag.com/r/kwallmar/hunit_gui/home Category: Testing Synopsis: A GUI testrunner for HUnit-Build-Type: Simple+Build-Type: Custom Data-Files: examples/Main.hs Maintainer: kim_hunitgui@arlim.org Description: