sydtest 0.21.0.0 → 0.22.0.0
raw patch · 4 files changed
+29/−4 lines, 4 files
Files
- CHANGELOG.md +6/−0
- src/Test/Syd/Output.hs +6/−2
- src/Test/Syd/SpecDef.hs +16/−1
- sydtest.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +## [0.22.0.0] - 2025-09-28++### Changed++* Fail on an empty test suite.+ ## [0.21.0.0] - 2025-05-09 This is technically a breaking change, but if you are not using the sydtest
src/Test/Syd/Output.hs view
@@ -70,7 +70,7 @@ outputFailuresWithHeading :: Settings -> ResultForest -> [[Chunk]] outputFailuresWithHeading settings rf =- if shouldExitFail settings rf+ if anyFailedTests settings rf then concat [ outputFailuresHeader,@@ -93,7 +93,11 @@ | testSuiteStatExamples /= testSuiteStatSuccesses ], [ [ chunk "Passed: ",- fore green $ chunk (T.pack (show testSuiteStatSuccesses))+ ( if testSuiteStatSuccesses <= 0+ then fore red+ else fore green+ )+ $ chunk (T.pack (show testSuiteStatSuccesses)) ], [ chunk "Failed: ", ( if testSuiteStatFailures > 0
src/Test/Syd/SpecDef.hs view
@@ -403,7 +403,22 @@ } shouldExitFail :: Settings -> ResultForest -> Bool-shouldExitFail settings = any (any (testRunReportFailed settings . timedValue . testDefVal))+shouldExitFail settings resultForest =+ -- Fail if there were no tests.+ --+ -- This is technically valid but in practice we don't ever want to+ -- consider an empty test suite succesfull.+ --+ -- By considering an empty test suite unsuccesful, we can catch cases in+ -- which we have accidentally used a filter that does not match any+ -- tests at all.+ null resultForest+ -- ... or if any tests failed.+ || anyFailedTests settings resultForest++anyFailedTests :: Settings -> ResultForest -> Bool+anyFailedTests settings resultForest =+ any (any (testRunReportFailed settings . timedValue . testDefVal)) resultForest data TestRunReport = TestRunReport { testRunReportExpectationMode :: !ExpectationMode,
sydtest.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: sydtest-version: 0.21.0.0+version: 0.22.0.0 synopsis: A modern testing framework for Haskell with good defaults and advanced testing features. description: A modern testing framework for Haskell with good defaults and advanced testing features. Sydtest aims to make the common easy and the hard possible. See https://github.com/NorfairKing/sydtest#readme for more information. category: Testing