MuCheck-HUnit 0.2.1.0 → 0.3.0.0
raw patch · 3 files changed
+10/−27 lines, 3 filesdep −MissingHdep ~MuCheckPVP ok
version bump matches the API change (PVP)
Dependencies removed: MissingH
Dependency ranges changed: MuCheck
API changes (from Hackage documentation)
Files
- MuCheck-HUnit.cabal +4/−6
- src/Main.hs +5/−3
- src/Test/MuCheck/TestAdapter/HUnit.hs +1/−18
MuCheck-HUnit.cabal view
@@ -1,5 +1,5 @@ name: MuCheck-HUnit-version: 0.2.1.0+version: 0.3.0.0 synopsis: Automated Mutation Testing for HUnit tests description: This package contains the test adapter for HUnit tests to use it with MuCheck homepage: https://bitbucket.com/osu-testing/mucheck-hunit@@ -19,13 +19,12 @@ source-repository this type: git location: https://bitbucket.org/osu-testing/mucheck-hunit.git- tag: 0.2.1.0+ tag: 0.3.0.0 executable mucheck-hunit build-depends: base >=4 && <5, HUnit>=1.0,- MissingH >= 1.3,- MuCheck== 0.2.1.*+ MuCheck== 0.3.0.0 default-language: Haskell2010 hs-source-dirs: src main-is: Main.hs@@ -35,8 +34,7 @@ exposed-modules: Test.MuCheck.TestAdapter.HUnit build-depends: base >=4 && <5, HUnit>=1.0,- MissingH >= 1.3,- MuCheck==0.2.1.*+ MuCheck==0.3.0.0 default-language: Haskell2010 hs-source-dirs: src
src/Main.hs view
@@ -1,5 +1,5 @@ module Main where-import System.Environment (getArgs, withArgs)+import System.Environment (getArgs) import Test.MuCheck (mucheck) import Test.MuCheck.TestAdapter.HUnit@@ -11,12 +11,14 @@ val <- getArgs case val of ("-h" : _ ) -> help- (fn : file : args) -> withArgs [] $ mucheck tsFn fn file args+ (fn : file : args) -> do (msum, _tsum) <- mucheck tsFn fn file args+ putStrLn (show msum) _ -> error "Need function file [args]\n\tUse -h to get help"- where tsFn :: [Mutant] -> [InterpreterOutput HUnitSummary] -> Summary+ where tsFn :: Mutant -> TestStr -> InterpreterOutput HUnitSummary -> Summary tsFn = testSummary help :: IO () help = putStrLn $ "mucheck function file [args]\n" ++ showAS ["E.g:", " mucheck-hunit qsort Examples/HUnitTest.hs 'runTestTT tests'", ""]+
src/Test/MuCheck/TestAdapter/HUnit.hs view
@@ -3,32 +3,15 @@ module Test.MuCheck.TestAdapter.HUnit where import qualified Test.HUnit as HUnit import Test.MuCheck.TestAdapter-import Test.MuCheck.Utils.Print (showA, showAS)-import Data.Hash.MD5 (md5s, Str(..)) import Data.Typeable-import Data.List((\\))-import Data.Either (partitionEithers) deriving instance Typeable HUnit.Counts type HUnitSummary = HUnit.Counts -- | Summarizable instance of `HUnitSumary` instance Summarizable HUnitSummary where- testSummary mutantFiles results = Summary logMsg- where (errorCases, executedCases) = partitionEithers results- errorFiles = map (\l -> ".mutants/" ++ (md5s $ Str l) ++ ".hs") mutantFiles \\ map fst executedCases- successCases = filter (isSuccess . snd) executedCases- failuresCases = filter (isFailure . snd) executedCases- runningErrorCases = filter ((>0) . HUnit.errors . snd) executedCases \\ failuresCases- failToFullyTryCases = filter ((\c -> HUnit.cases c > HUnit.tried c) . snd) executedCases- logMsg = showAS ["Details:",- "Loading error files:",showA errorFiles,- "Loading error messages:",showA errorCases,- "Successes:", showA successCases,- "Failures:", showA failuresCases,- "Error while running:", showA runningErrorCases,- "Incompletely tested (may include failures and running errors):",showA failToFullyTryCases]+ testSummary _mutant _test result = Summary $ _ioLog result isSuccess c = (HUnit.cases c == HUnit.tried c) && HUnit.failures c == 0 && HUnit.errors c == 0 isFailure c = HUnit.failures c > 0