HUnit-Plus 0.3.0 → 0.3.1
raw patch · 4 files changed
+53/−24 lines, 4 filesdep −deepseqPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: deepseq
API changes (from Hackage documentation)
- Test.HUnitPlus.Main: Opts :: ![String] -> ![String] -> ![String] -> ![ConsoleMode] -> ![String] -> Opts
+ Test.HUnitPlus.Main: Opts :: [String] -> [String] -> [String] -> [ConsoleMode] -> [String] -> Opts
- Test.HUnitPlus.Main: consmode :: Opts -> ![ConsoleMode]
+ Test.HUnitPlus.Main: consmode :: Opts -> [ConsoleMode]
- Test.HUnitPlus.Main: filters :: Opts -> ![String]
+ Test.HUnitPlus.Main: filters :: Opts -> [String]
- Test.HUnitPlus.Main: testlist :: Opts -> ![String]
+ Test.HUnitPlus.Main: testlist :: Opts -> [String]
- Test.HUnitPlus.Main: txtreport :: Opts -> ![String]
+ Test.HUnitPlus.Main: txtreport :: Opts -> [String]
- Test.HUnitPlus.Main: xmlreport :: Opts -> ![String]
+ Test.HUnitPlus.Main: xmlreport :: Opts -> [String]
Files
- HUnit-Plus.cabal +7/−5
- LICENSE +1/−2
- src/Test/HUnitPlus/Main.hs +11/−11
- src/Test/HUnitPlus/Text.hs +34/−6
HUnit-Plus.cabal view
@@ -1,6 +1,6 @@ Name: HUnit-Plus Category: Testing, Test-Version: 0.3.0+Version: 0.3.1 License: BSD3 License-File: LICENSE Author: Eric McCorkle@@ -17,12 +17,14 @@ HUnit framework. Unlike HUnit, HUnit-Plus uses the same data structures as cabal's "Distribution.TestSuite" framework, allowing full compatibility with cabal's testing facilities.-+ . HUnit-Plus also provides expanded reporting capabilities, including the ability to generate JUnit-style XML reports, along with a very flexible mechanism for selecting which tests to be executed. Lastly, HUnit-Plus provides a wrapper which generates standalone test-execution programs from a set of test suites.+ .+ This is release candidate 2 for 1.0 (1.0-RC2) Build-type: Simple Cabal-version: >= 1.16 @@ -35,7 +37,7 @@ type: exitcode-stdio-1.0 Main-Is: RunTests.hs hs-source-dirs: src test- build-depends: base >= 4.4.0 && < 5, Cabal >= 1.16.0, deepseq, hexpat, timeit,+ build-depends: base >= 4.4.0 && < 5, Cabal >= 1.16.0, hexpat, timeit, cmdargs, hashable, containers, time, old-locale, hostname, parsec, bytestring, directory ghc-options: -fhpc@@ -43,9 +45,9 @@ Library default-language: Haskell2010 hs-source-dirs: src- build-depends: base >= 4.4.0 && < 5, Cabal >= 1.16.0, deepseq, hexpat, timeit,+ build-depends: base >= 4.4.0 && < 5, Cabal >= 1.16.0, hexpat, timeit, cmdargs, hashable, containers, time, old-locale, hostname,- parsec, bytestring+ bytestring, parsec exposed-modules: Test.HUnitPlus.Base Test.HUnitPlus.Execution Test.HUnitPlus.Filter
LICENSE view
@@ -1,5 +1,4 @@-Copyright (c) 2014, Eric McCorkle-All rights reserved.+Copyright (c) 2014, Eric McCorkle. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
src/Test/HUnitPlus/Main.hs view
@@ -94,22 +94,22 @@ -- must contain a single value, or be empty, or else the test -- program will report bad options. If the list is empty, no XML -- report will be generated.- xmlreport :: ![String],+ xmlreport :: [String], -- | Filters in string format, specifying which tests should be -- run. If no filters are given, then all tests will be run. For -- information on the string format, see "Test.HUnitPlus.Filter".- filters :: ![String],+ filters :: [String], -- | A file to which to write a plain-text report. The list must -- contain a single value, or be empty, or else the test program -- will report bad options. If the list is empty, no report will -- be generated.- txtreport :: ![String],+ txtreport :: [String], -- | The behavior of the console output.- consmode :: ![ConsoleMode],+ consmode :: [ConsoleMode], -- | Files from which to read testlists. Multiple files may be -- specified. The contents will be parsed and added to the list -- of filters specified on the command line.- testlist :: ![String]+ testlist :: [String] } deriving (Typeable, Show, Data) @@ -119,18 +119,18 @@ Opts { testlist = [] &= explicit+ &= typFile &= name "l" &= name "testlist"- &= help "Read test filters from FILE"- &= typFile,+ &= help "Read test filters from FILE", xmlreport = []+ &= typFile &= help "Output an XML report, with an optional filename for the report (default is \"report.xml\")"- &= opt "report.xml"- &= typFile,+ &= opt "report.xml", txtreport = []+ &= typFile &= help "Output a plain text report, with an optional filename for the report (default is \"report.txt\")"- &= opt "report.txt"- &= typFile,+ &= opt "report.txt", consmode = [] &= explicit &= name "c"
src/Test/HUnitPlus/Text.hs view
@@ -86,17 +86,29 @@ path = showPath (stPath ss) line = "### " ++ kind ++ path ++ ": " ++ msg ++ "\n" in- if verbose then put line us- else return us+ if verbose then put line us else return us + reportStartSuite ss us =+ let+ line = "Test suite " ++ stName ss ++ " starting\n"+ in+ if verbose then put line us else return us++ reportEndSuite time ss us =+ let+ timestr = printf "%.6f" time+ line = "Test suite" ++ stName ss ++ " completed in " +++ timestr ++ " sec\n"+ in+ if verbose then put line us else return us+ reportStartCase ss us = let path = showPath (stPath ss) line = if null path then "Test case starting\n" else "Test case " ++ path ++ " starting\n" in- if verbose then put line us- else return us+ if verbose then put line us else return us reportEndCase time ss us = let@@ -105,11 +117,26 @@ line = if null path then "Test completed in " ++ timestr ++ " sec\n" else "Test " ++ path ++ " completed in " ++ timestr ++ " sec\n" in- if verbose then put line us- else return us+ if verbose then put line us else return us++ reportEnd time counts us =+ let+ countstr = showCounts counts ++ "\n"+ timestr = printf "%.6f" time+ timeline = "Tests completed in " ++ timestr ++ " sec\n"+ in do+ if verbose+ then do+ us' <- put timeline us+ put countstr us'+ else+ put countstr us in defaultReporter { reporterStart = return initUs,+ reporterEnd = reportEnd,+ reporterStartSuite = reportStartSuite,+ reporterEndSuite = reportEndSuite, reporterStartCase = reportStartCase, reporterEndCase = reportEndCase, reporterSystemOut = reportOutput "STDOUT " "STDOUT from ",@@ -234,6 +261,7 @@ in defaultReporter { reporterStart = return 0,+ reporterEnd = (\_ _ _ -> do hPutStr stderr "\n"; return 0), reporterEndCase = (\_ ss us -> termPut (showCounts (stCounts ss)) False us), reporterError = reportProblem "Error:" "Error in: ",