packages feed

test-framework 0.1.1 → 0.1.2

raw patch · 4 files changed

+17/−15 lines, 4 filesdep ~ansi-terminaldep ~ansi-wl-pprintdep ~base

Dependency ranges changed: ansi-terminal, ansi-wl-pprint, base

Files

Test/Framework/Runners/Console.hs view
@@ -100,7 +100,7 @@             exitWith (ExitFailure 1)  defaultMainWithOpts :: [Test] -> RunnerOptions -> IO ()-defaultMainWithOpts tests ropts = hideCursorIn $ do+defaultMainWithOpts tests ropts = hideCursorDuring $ do     let ropts' = completeRunnerOptions ropts          -- Get a lazy list of the test results, as executed in parallel@@ -152,11 +152,15 @@   testStatisticsProgressBar :: TestStatistics -> Doc-testStatisticsProgressBar test_statistics = showProgressBar (colorPassOrFail no_failures) 80 (Progress run_tests total_tests)+testStatisticsProgressBar test_statistics = progressBar (colorPassOrFail no_failures) width (Progress run_tests total_tests)   where     run_tests   = testCountTotal (ts_run_tests test_statistics)     total_tests = testCountTotal (ts_total_tests test_statistics)     no_failures = ts_no_failures test_statistics+    -- We assume a terminal width of 80, but we can't make the progress bar 80 characters wide.  Why?  Because if we+    -- do so, when we write the progress bar out Windows will move the cursor onto the next line!  By using a slightly+    -- smaller width we prevent this from happening.  Bit of a hack, but it does the job.+    width = 79  updateTestStatistics :: (Int -> TestCount) -> Bool -> TestStatistics -> TestStatistics updateTestStatistics count_constructor test_suceeded test_statistics = test_statistics {@@ -202,7 +206,7 @@     putTestHeader indent_level test_name (brackets (text intermediate_str))     putDoc progress_bar     hFlush stdout-    showImprovingTestResult (previousLine 1 >> clearLine) indent_level test_name progress_bar rest+    showImprovingTestResult (cursorUpLine 1 >> clearLine) indent_level test_name progress_bar rest   where       intermediate_str = show intermediate 
Test/Framework/Runners/Console/ProgressBar.hs view
@@ -1,5 +1,5 @@ module Test.Framework.Runners.Console.ProgressBar (-        Progress(..), showProgressBar+        Progress(..), progressBar     ) where  import Text.PrettyPrint.ANSI.Leijen hiding (width)@@ -7,8 +7,8 @@  data Progress = Progress Int Int -showProgressBar :: (Doc -> Doc) -> Int -> Progress -> Doc-showProgressBar color width (Progress count total) = char '[' <> progress_doc <> space_doc <> char ']'+progressBar :: (Doc -> Doc) -> Int -> Progress -> Doc+progressBar color width (Progress count total) = char '[' <> progress_doc <> space_doc <> char ']'   where     -- The available width takes account of the enclosing brackets     available_width = width - 2
Test/Framework/Runners/Console/Utilities.hs view
@@ -1,5 +1,5 @@ module Test.Framework.Runners.Console.Utilities (-        hideCursorIn+        hideCursorDuring     ) where  import System.Console.ANSI@@ -9,7 +9,5 @@ import Prelude hiding (catch)  -hideCursorIn :: IO () -> IO ()-hideCursorIn action = do-    hideCursor-    catch (action >> showCursor) (\exception -> showCursor >> throwIO exception)+hideCursorDuring :: IO a -> IO a+hideCursorDuring action = bracket hideCursor (const showCursor) (const action)
test-framework.cabal view
@@ -1,5 +1,5 @@ Name:                test-framework-Version:             0.1.1+Version:             0.1.2 Cabal-Version:       >= 1.2 Category:            Testing Synopsis:            Framework for running and organising tests, with HUnit and QuickCheck support@@ -65,7 +65,7 @@                 Build-Depends:          HUnit >= 1.2                 Exposed-Modules:        Test.Framework.Providers.HUnit         -        Build-Depends:          ansi-terminal >= 0.2.1, ansi-wl-pprint >= 0.2, regex-posix >= 0.72+        Build-Depends:          ansi-terminal >= 0.4.0, ansi-wl-pprint >= 0.4.0, regex-posix >= 0.72         if flag(splitBase)                 Build-Depends:          base >= 3, random >= 1.0, containers >= 0.1         else@@ -89,7 +89,7 @@ Executable test-framework-tests         Main-Is:                Test/Framework/Tests.hs -        Build-Depends:          QuickCheck >= 1.1, HUnit >= 1.2, ansi-terminal >= 0.2.1, ansi-wl-pprint >= 0.2, regex-posix >= 0.72+        Build-Depends:          QuickCheck >= 1.1, HUnit >= 1.2, ansi-terminal >= 0.4.0, ansi-wl-pprint >= 0.4.0, regex-posix >= 0.72         if flag(splitBase)                 Build-Depends:          base >= 3, random >= 1.0, containers >= 0.1         else@@ -116,7 +116,7 @@ Executable test-framework-example         Main-Is:                Test/Framework/Example.lhs -        Build-Depends:          QuickCheck >= 1.1, HUnit >= 1.2, ansi-terminal >= 0.2.1, ansi-wl-pprint >= 0.2, regex-posix >= 0.72+        Build-Depends:          QuickCheck >= 1.1, HUnit >= 1.2, ansi-terminal >= 0.4.0, ansi-wl-pprint >= 0.4.0, regex-posix >= 0.72         if flag(splitBase)                 Build-Depends:          base >= 3, random >= 1.0, containers >= 0.1         else