packages feed

tasty-hunit 0.10.0.3 → 0.10.1

raw patch · 5 files changed

+30/−52 lines, 5 filesdep ~basedep ~call-stackdep ~tastynew-uploader

Dependency ranges changed: base, call-stack, tasty

Files

CHANGELOG.md view
@@ -1,11 +1,18 @@ Changes ======= +Version 0.10.1+---------------++* Provide an explicit implementation of `displayException`+  in `instance Exception HUnitFailure`+  ([#330](https://github.com/UnkindPartition/tasty/issues/330)).+ Version 0.10.0.3 ----------------  The only point of this release is to introduce compatibility with GHCs back to 7.0-(see https://github.com/feuerbach/tasty/pull/287).+(see https://github.com/UnkindPartition/tasty/pull/287).  Note, however, that these changes are not merged to the master branch, and the future releases will only support the GHC/base versions from the last 5 years,
Test/Tasty/HUnit.hs view
@@ -15,7 +15,7 @@ -- >    -- assertion no. 3 (would have failed, but won't be executed because -- >    -- the previous assertion has already failed) -- >    "foo" @?= "bar"-{-# LANGUAGE CPP, TypeFamilies, DeriveDataTypeable #-}+{-# LANGUAGE TypeFamilies, DeriveDataTypeable #-} module Test.Tasty.HUnit   (     -- * Constructing test cases@@ -33,7 +33,6 @@     -- * Data types   , Assertion   , HUnitFailure(..)-#if MIN_VERSION_base(4,5,0)     -- * Accurate location for domain-specific assertion functions     -- | It is common to define domain-specific assertion functions based     -- on the standard ones, e.g.@@ -51,7 +50,6 @@     -- > assertNonEmpty = assertBool "List is empty" . not . null     --     , HasCallStack-#endif     -- * Deprecated functions and types     -- | These definitions come from HUnit, but I don't see why one would     -- need them. If you have a valid use case for them, please contact me@@ -67,14 +65,9 @@ import Test.Tasty.HUnit.Orig import Test.Tasty.HUnit.Steps -import Control.Exception import Data.Typeable--#if MIN_VERSION_base(4,5,0) import Data.CallStack (HasCallStack)-#else-#define HasCallStack Eq ()-#endif+import Control.Exception  -- | Turn an 'Assertion' into a tasty test case testCase :: TestName -> Assertion -> TestTree
Test/Tasty/HUnit/Orig.hs view
@@ -1,8 +1,7 @@-{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts, FlexibleInstances, TypeSynonymInstances #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleInstances, TypeSynonymInstances #-} -#if MIN_VERSION_base(4,5,0)-{-# LANGUAGE ConstraintKinds #-}-#endif+-- required for HasCallStack by different versions of GHC+{-# LANGUAGE ConstraintKinds, FlexibleContexts #-}  -- | This is the code copied from the original hunit package (v. 1.2.5.2). -- with minor modifications@@ -11,28 +10,8 @@ import qualified Control.Exception as E import Control.Monad import Data.Typeable (Typeable)--#if MIN_VERSION_base(4,5,0) import Data.CallStack-#else-#define HasCallStack Eq () -callStack :: [a]-callStack = []---- https://hackage.haskell.org/package/base-4.14.0.0/docs/GHC-Stack.html#t:SrcLoc-data SrcLoc = SrcLoc-  { srcLocPackage   :: String-  , srcLocModule    :: String-  , srcLocFile      :: String-  , srcLocStartLine :: Int-  , srcLocStartCol  :: Int-  , srcLocEndLine   :: Int-  , srcLocEndCol    :: Int-  } deriving (Eq, Show)--#endif- -- Interfaces -- ---------- @@ -156,7 +135,8 @@ -- | Exception thrown by 'assertFailure' etc. data HUnitFailure = HUnitFailure (Maybe SrcLoc) String     deriving (Eq, Show, Typeable)-instance E.Exception HUnitFailure+instance E.Exception HUnitFailure where+  displayException (HUnitFailure mbloc s) = prependLocation mbloc s  prependLocation :: Maybe SrcLoc -> String -> String prependLocation mbloc s =@@ -187,12 +167,12 @@ -- -- Since an 'Assertion' can be a sequence of @Assertion@s and @IO@ actions, -- there is a fair amount of flexibility of what can be achieved.  As a rule,--- the resulting @Assertion@ should be the body of a 'TestCase' or part of+-- the resulting @Assertion@ should be the body of a @TestCase@ or part of -- a @TestCase@; it should not be used to assert multiple, independent -- conditions. ----- If more complex arrangements of assertions are needed, 'Test's and--- 'Testable' should be used.+-- If more complex arrangements of assertions are needed, @Test@ and+-- @Testable@ should be used. class Assertable t  where assert :: t -> Assertion 
Test/Tasty/HUnit/Steps.hs view
@@ -25,10 +25,8 @@         tme <- getTime         atomicModifyIORef ref (\l -> ((tme,msg):l, ())) -    hunitResult <- (Right <$> assertionFn stepFn) `catches`-      [ Handler (\(HUnitFailure mbloc errMsg) -> return $ Left (prependLocation mbloc errMsg))-      , Handler (\(SomeException ex)          -> return $ Left (show ex))-      ]+    hunitResult <- (Right <$> assertionFn stepFn) `catch`+        \(SomeException ex) -> return $ Left (displayException ex)      endTime <- getTime 
tasty-hunit.cabal view
@@ -1,8 +1,8 @@--- Initial tasty-hunit.cabal generated by cabal init.  For further+-- Initial tasty-hunit.cabal generated by cabal init.  For further  -- documentation, see http://haskell.org/cabal/users-guide/  name:                tasty-hunit-version:             0.10.0.3+version:             0.10.1 synopsis:            HUnit support for the Tasty test framework. description:         HUnit support for the Tasty test framework.                      .@@ -14,9 +14,9 @@ license-file:        LICENSE author:              Roman Cheplyaka <roma@ro-che.info> maintainer:          Roman Cheplyaka <roma@ro-che.info>-homepage:            https://github.com/feuerbach/tasty-bug-reports:         https://github.com/feuerbach/tasty/issues--- copyright:+homepage:            https://github.com/UnkindPartition/tasty+bug-reports:         https://github.com/UnkindPartition/tasty/issues+-- copyright:            category:            Testing build-type:          Simple extra-source-files:  CHANGELOG.md@@ -24,7 +24,7 @@  Source-repository head   type:     git-  location: git://github.com/feuerbach/tasty.git+  location: https://github.com/UnkindPartition/tasty.git   subdir:   hunit  library@@ -32,9 +32,9 @@   other-modules:       Test.Tasty.HUnit.Orig                        Test.Tasty.HUnit.Steps   other-extensions:    TypeFamilies, DeriveDataTypeable-  build-depends:       base >= 4.3 && < 5, tasty >= 1.2.2-  if impl(ghc >= 7.4)-    build-depends: call-stack-  -- hs-source-dirs:+  build-depends:       base >= 4.8 && < 5,+                       tasty >= 1.2.2 && < 1.6,+                       call-stack < 0.5+  -- hs-source-dirs:         default-language:    Haskell2010   ghc-options: -Wall