sydtest-hspec 0.2.0.0 → 0.3.0.0
raw patch · 3 files changed
+17/−16 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- src/Test/Syd/Hspec.hs +10/−15
- sydtest-hspec.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +## [0.3.0.0] - 2022-04-28++### Added++* Compatibility with `sydtest >=0.10`+ ## [0.2.0.0] - 2022-04-26 ### Added
src/Test/Syd/Hspec.hs view
@@ -118,25 +118,20 @@ -- a test is pending so we have no choice. Hspec.Pending _ _ -> (TestPassed, Nothing) Hspec.Failure mloc fr ->- let withExtraContext :: Maybe String -> Assertion -> Assertion- withExtraContext = maybe id (\extraContext a -> Context a extraContext)+ let withExtraContext :: Maybe String -> SomeException -> SomeException+ withExtraContext = maybe id (\extraContext se -> SomeException $ addContextToException se extraContext) niceLocation :: Hspec.Location -> String niceLocation Hspec.Location {..} = intercalate ":" [locationFile, show locationLine, show locationColumn]- withLocationContext :: Assertion -> Assertion+ withLocationContext :: SomeException -> SomeException withLocationContext = withExtraContext $ niceLocation <$> mloc- assertion = case fr of- Hspec.NoReason -> Right $ ExpectationFailed "Hspec had no more information about this failure."- Hspec.Reason s -> Right $ ExpectationFailed s- Hspec.ExpectedButGot mExtraContext expected actual -> Right $ withExtraContext mExtraContext $ NotEqualButShouldHaveBeenEqual actual expected- Hspec.Error mExtraContext e -> withExtraContext mExtraContext <$> Left (displayException e)+ exception :: SomeException+ exception = case fr of+ Hspec.NoReason -> SomeException $ ExpectationFailed "Hspec had no more information about this failure."+ Hspec.Reason s -> SomeException $ ExpectationFailed s+ Hspec.ExpectedButGot mExtraContext expected actual -> withExtraContext mExtraContext $ SomeException $ NotEqualButShouldHaveBeenEqual actual expected+ Hspec.Error mExtraContext e -> withExtraContext mExtraContext e in ( TestFailed,- Just- ( Context- <$> ( withLocationContext <$> assertion- )- <*> pure- (Hspec.resultInfo result)- )+ Just $ SomeException $ addContextToException (withLocationContext exception) (Hspec.resultInfo result) ) let testRunResultNumTests = Nothing let testRunResultNumShrinks = Nothing
sydtest-hspec.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: sydtest-hspec-version: 0.2.0.0+version: 0.3.0.0 synopsis: An Hspec companion library for sydtest category: Testing homepage: https://github.com/NorfairKing/sydtest#readme