inspection-testing 0.1.1.1 → 0.1.1.2
raw patch · 4 files changed
+17/−12 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- README.md +2/−1
- Test/Inspection/Plugin.hs +10/−10
- inspection-testing.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for inspection-testing +## 0.1.1.2 -- 2017-11-12++* Hotfix: Do not abort if there are expected failures+ ## 0.1.1.1 -- 2017-11-12 * Show summary stats
README.md view
@@ -34,7 +34,8 @@ $ ghc Simple.hs [1 of 1] Compiling Simple ( Simple.hs, Simple.o ) examples/Simple.hs:14:1: lhs === rhs passed.-Test.Inspection tested 1 obligation.+inspection testing successful+ expected successes: 1 ``` See the [`examples/`](examples/) directory for more examples of working proofs.
Test/Inspection/Plugin.hs view
@@ -8,7 +8,6 @@ import System.Exit import Data.Either import Data.Maybe-import Data.Foldable import qualified Data.Map.Strict as M import qualified Language.Haskell.TH.Syntax as TH @@ -183,20 +182,21 @@ stats <- M.unionsWith (+) <$> mapM (checkObligation guts') obligations let n = sum stats :: Int - let error_mesage = nest 2 $- vcat [ nest 2 (desc s) <> colon <+> ppr n- | s <- [minBound..maxBound]- , Just n <- return $ M.lookup s stats]+ let q :: Stat -> Int+ q s = fromMaybe 0 $ M.lookup s stats - if M.lookup ExpSuccess stats == Just n- then putMsg $ text "Test.Inspection tested" <+> ppr n <+>- text "obligation" <> (if n == 1 then empty else text "s") <> dot+ let summary_message = nest 2 $+ vcat [ nest 2 (desc s) <> colon <+> ppr (q s)+ | s <- [minBound..maxBound], q s > 0 ]++ if q ExpSuccess + q ExpFailure == n+ then putMsg $ text "inspection testing successful" $$ summary_message else case upon_failure of AbortCompilation -> do- errorMsg $ text "inspection testing unsuccessful" $$ error_mesage+ errorMsg $ text "inspection testing unsuccessful" $$ summary_message liftIO $ exitFailure -- kill the compiler. Is there a nicer way? KeepGoing -> do- warnMsg $ text "inspection testing unsuccessful" $$ error_mesage+ warnMsg $ text "inspection testing unsuccessful" $$ summary_message return guts'
inspection-testing.cabal view
@@ -1,5 +1,5 @@ name: inspection-testing-version: 0.1.1.1+version: 0.1.1.2 synopsis: GHC plugin to do inspection testing description: Some carefully crafted libraries make promises to their users beyond functionality and performance.