sydtest-hspec 0.4.0.2 → 0.4.0.3
raw patch · 3 files changed
+33/−26 lines, 3 filesdep ~sydtestPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: sydtest
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- src/Test/Syd/Hspec.hs +24/−23
- sydtest-hspec.cabal +3/−3
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +## [0.4.0.3] - 2024-10-13++### Added++* Compatibility with `sydtest >= 0.18`+ ## [0.4.0.2] - 2023-12-06 ### Added
src/Test/Syd/Hspec.hs view
@@ -127,23 +127,24 @@ ) callback report ProgressTestDone- let (testRunResultStatus, testRunResultException) = case Hspec.resultStatus result of- Hspec.Success -> (TestPassed, Nothing)- -- This is certainly a debatable choice, but there's no need to make- -- tests fail here, and there's no way to know ahead of time whether- -- a test is pending so we have no choice.- Hspec.Pending _ _ -> (TestPassed, Nothing)- Hspec.Failure mloc fr ->- 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 :: SomeException -> SomeException- withLocationContext = withExtraContext $ niceLocation <$> mloc- exception = failureReasonToException withExtraContext fr- in ( TestFailed,- Just $ SomeException $ addContextToException (withLocationContext exception) (Hspec.resultInfo result)- )+ (testRunResultStatus, testRunResultException) <- case Hspec.resultStatus result of+ Hspec.Success -> pure (TestPassed, Nothing)+ -- This is certainly a debatable choice, but there's no need to make+ -- tests fail here, and there's no way to know ahead of time whether+ -- a test is pending so we have no choice.+ Hspec.Pending _ _ -> pure (TestPassed, Nothing)+ Hspec.Failure mloc fr -> do+ 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 :: SomeException -> SomeException+ withLocationContext = withExtraContext $ niceLocation <$> mloc+ exception <- failureReasonToException withExtraContext fr+ pure+ ( TestFailed,+ Just $ SomeException $ addContextToException (withLocationContext exception) (Hspec.resultInfo result)+ ) let testRunResultNumTests = Nothing let testRunResultNumShrinks = Nothing let testRunResultGoldenCase = Nothing@@ -155,12 +156,12 @@ pure TestRunResult {..} -failureReasonToException :: (Maybe String -> SomeException -> SomeException) -> Hspec.FailureReason -> SomeException+failureReasonToException :: (Maybe String -> SomeException -> SomeException) -> Hspec.FailureReason -> IO SomeException failureReasonToException withExtraContext = \case- 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+ Hspec.NoReason -> pure $ SomeException $ ExpectationFailed "Hspec had no more information about this failure."+ Hspec.Reason s -> pure $ SomeException $ ExpectationFailed s+ Hspec.ExpectedButGot mExtraContext expected actual -> withExtraContext mExtraContext . SomeException <$> mkNotEqualButShouldHaveBeenEqual actual expected+ Hspec.Error mExtraContext e -> pure $ withExtraContext mExtraContext e #if MIN_VERSION_hspec_core(2,11,0)- Hspec.ColorizedReason s -> SomeException $ ExpectationFailed s+ Hspec.ColorizedReason s -> pure $ SomeException $ ExpectationFailed s #endif
sydtest-hspec.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: sydtest-hspec-version: 0.4.0.2+version: 0.4.0.3 synopsis: An Hspec companion library for sydtest category: Testing homepage: https://github.com/NorfairKing/sydtest#readme@@ -37,7 +37,7 @@ , hspec-core >=2.7.10 , mtl , stm- , sydtest >=0.14.0.0+ , sydtest >=0.18.0.0 default-language: Haskell2010 test-suite sydtest-hspec-test