MuCheck-Hspec (empty) → 0.2.0.0
raw patch · 6 files changed
+95/−0 lines, 6 filesdep +MuCheckdep +basedep +hspecsetup-changed
Dependencies added: MuCheck, base, hspec, hspec-core
Files
- LICENSE +0/−0
- MuCheck-Hspec.cabal +42/−0
- Setup.hs +3/−0
- changes.md +0/−0
- src/Main.hs +23/−0
- src/Test/MuCheck/TestAdapter/Hspec.hs +27/−0
+ LICENSE view
+ MuCheck-Hspec.cabal view
@@ -0,0 +1,42 @@+name: MuCheck-Hspec+version: 0.2.0.0+synopsis: Automated Mutation Testing for Hspec tests+description: This package contains the test adapter for Hspec tests to use it with MuCheck+homepage: https://bitbucket.com/osu-testing/mucheck-hspec+license: GPL-2+license-file: LICENSE+author: Rahul Gopinath <rahul@gopinath.org>+maintainer: rahul@gopinath.org+category: Testing+build-type: Simple+cabal-version: >= 1.10+extra-source-files: changes.md++source-repository head+ type: git+ location: https://bitbucket.org/osu-testing/mucheck-hspec.git++source-repository this+ type: git+ location: https://bitbucket.org/osu-testing/mucheck-hspec.git+ tag: 0.2.0.0++executable mucheck-hspec+ build-depends: base >=4 && <5,+ hspec>=2.0,+ hspec-core >= 2.0,+ MuCheck== 0.2.0.*+ default-language: Haskell2010+ hs-source-dirs: src+ main-is: Main.hs+ ghc-options: -Wall -fno-warn-orphans++library+ exposed-modules: Test.MuCheck.TestAdapter.Hspec+ build-depends: base >=4 && <5,+ hspec>=2.0,+ hspec-core >= 2.0,+ MuCheck==0.2.0.*+ default-language: Haskell2010+ hs-source-dirs: src+
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple++main = defaultMain
+ changes.md view
+ src/Main.hs view
@@ -0,0 +1,23 @@+module Main where+import System.Environment (getArgs, withArgs)++import Test.MuCheck (mucheck)+import Test.MuCheck.TestAdapter.Hspec+import Test.MuCheck.TestAdapter+import Test.MuCheck.Utils.Print++main :: IO ()+main = do+ val <- getArgs+ case val of+ ("-h" : _ ) -> help+ (fn : file : modulename : args) -> withArgs [] $ mucheck tsFn fn file modulename args+ _ -> error "Need function file modulename [args]\n\tUse -h to get help"+ where tsFn :: [MutantFilename] -> [InterpreterOutput HspecSummary] -> Summary+ tsFn = testSummary+++help :: IO ()+help = putStrLn $ "mucheck function file modulename [args]\n" ++ showAS ["E.g:",+ " mucheck-hspec qsort Examples/HspecTest.hs Examples.HspecTest spec"]+
+ src/Test/MuCheck/TestAdapter/Hspec.hs view
@@ -0,0 +1,27 @@+{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable, TypeSynonymInstances #-}+-- | Module for using Hspec tests+module Test.MuCheck.TestAdapter.Hspec where+import qualified Test.Hspec.Core.Runner as Hspec+import Test.MuCheck.TestAdapter+import Test.MuCheck.Utils.Print (showA, showAS)++import Data.Typeable+import Data.Either (partitionEithers)+import Data.List((\\))++deriving instance Typeable Hspec.Summary+type HspecSummary = Hspec.Summary++-- | Summarizable instance of `Hspec.Summary`+instance Summarizable HspecSummary where+ testSummary mutantFiles results = Summary logMsg+ where (errorCases, executedCases) = partitionEithers results+ [successCases, failureCases] = map (\c -> filter (c . snd) executedCases) [isSuccess, isFailure]+ errorFiles = mutantFiles \\ map fst executedCases+ logMsg = showAS ["Details:",+ "Loading error files:", showA errorFiles,+ "Loading error messages:", showA errorCases,+ "Successes:", showA successCases,+ "Failure:", showA failureCases]+ isSuccess (Hspec.Summary { Hspec.summaryExamples = se, Hspec.summaryFailures = sf } ) = sf == 0+