hspec-meta 2.11.10 → 2.11.11
raw patch · 3 files changed
+37/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- LICENSE +1/−1
- hspec-core/src/Test/Hspec/Core/Example/Location.hs +33/−4
- hspec-meta.cabal +3/−3
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2011-2024 Simon Hengel <sol@typeful.net>+Copyright (c) 2011-2025 Simon Hengel <sol@typeful.net> Copyright (c) 2011-2012 Trystan Spangler <trystan.s@comcast.net> Copyright (c) 2011-2011 Greg Weber <greg@gregweber.info>
hspec-core/src/Test/Hspec/Core/Example/Location.hs view
@@ -1,9 +1,11 @@ {-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -Wno-missing-signatures #-} module Test.Hspec.Core.Example.Location ( Location(..) , extractLocation #ifdef TEST+, parseBacktraces , parseAssertionFailed , parseCallStack , parseLocation@@ -19,6 +21,10 @@ import Data.Char import GHC.IO.Exception +#if MIN_VERSION_base(4,21,0)+import Control.Exception.Context+#endif+ #ifdef mingw32_HOST_OS import System.FilePath #endif@@ -37,8 +43,27 @@ <|> locationFromRecConError e <|> locationFromIOException e <|> locationFromNoMethodError e+#if !MIN_VERSION_base(4,21,0) <|> locationFromAssertionFailed e+#else+ <|> locationFromSomeException e +locationFromSomeException :: SomeException -> Maybe Location+locationFromSomeException = someExceptionContext >>> locationFromExceptionContext++locationFromExceptionContext :: ExceptionContext -> Maybe Location+locationFromExceptionContext = displayExceptionContext >>> parseBacktraces+#endif++_ignoreUnusedWarning = (parseBacktraces, locationFromAssertionFailed)++parseBacktraces :: String -> Maybe Location+parseBacktraces =+ lines+ >>> dropWhile (/= "HasCallStack backtrace:") >>> drop 1+ >>> takeWhile (isPrefixOf " ")+ >>> parseCallStack+ locationFromNoMethodError :: SomeException -> Maybe Location locationFromNoMethodError e = case fromException e of Just (NoMethodError s) -> listToMaybe (words s) >>= parseSourceSpan@@ -50,13 +75,17 @@ Nothing -> Nothing parseAssertionFailed :: String -> Maybe Location-parseAssertionFailed loc = parseCallStack loc <|> parseSourceSpan loc+parseAssertionFailed loc = parseCallStack (lines loc) <|> parseSourceSpan loc locationFromErrorCall :: SomeException -> Maybe Location locationFromErrorCall e = case fromException e of+#if MIN_VERSION_base(4,21,0)+ Just (ErrorCall _) -> Nothing+#else Just (ErrorCallWithLocation err loc) ->- parseCallStack loc <|>+ parseCallStack (lines loc) <|> fromPatternMatchFailureInDoExpression err+#endif Nothing -> Nothing locationFromPatternMatchFail :: SomeException -> Maybe Location@@ -83,8 +112,8 @@ stripPrefix "Pattern match failure in do expression at " input >>= parseSourceSpan #endif -parseCallStack :: String -> Maybe Location-parseCallStack input = case reverse (lines input) of+parseCallStack :: [String] -> Maybe Location+parseCallStack input = case reverse input of [] -> Nothing line : _ -> findLocation line where
hspec-meta.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.37.0.+-- This file has been generated from package.yaml by hpack version 0.38.0. -- -- see: https://github.com/sol/hpack name: hspec-meta-version: 2.11.10+version: 2.11.11 synopsis: A version of Hspec which is used to test Hspec itself description: A stable version of Hspec which is used to test the in-development version of Hspec.@@ -15,7 +15,7 @@ bug-reports: https://github.com/hspec/hspec/issues author: Simon Hengel <sol@typeful.net> maintainer: Simon Hengel <sol@typeful.net>-copyright: (c) 2011-2024 Simon Hengel,+copyright: (c) 2011-2025 Simon Hengel, (c) 2011-2012 Trystan Spangler, (c) 2011 Greg Weber license: MIT