tasty-checklist 1.0.6.0 → 1.0.8.0
raw patch · 3 files changed
+44/−15 lines, 3 filesdep ~doctestPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: doctest
API changes (from Hackage documentation)
+ Test.Tasty.Checklist: ($dmtestShow) :: (TestShow v, Show v) => v -> String
- Test.Tasty.Checklist: [Got] :: Text -> (i -> Bool) -> DerivedVal i Bool
+ Test.Tasty.Checklist: [Got] :: forall i. Text -> (i -> Bool) -> DerivedVal i Bool
- Test.Tasty.Checklist: [Observe] :: Eq d => Text -> (i -> d) -> d -> (d -> d -> String) -> DerivedVal i d
+ Test.Tasty.Checklist: [Observe] :: forall d i. Eq d => Text -> (i -> d) -> d -> (d -> d -> String) -> DerivedVal i d
- Test.Tasty.Checklist: [Val] :: (TestShow d, Eq d) => Text -> (i -> d) -> d -> DerivedVal i d
+ Test.Tasty.Checklist: [Val] :: forall d i. (TestShow d, Eq d) => Text -> (i -> d) -> d -> DerivedVal i d
- Test.Tasty.Checklist: checkValues :: CanCheck => TestShow dType => dType -> Assignment (DerivedVal dType) idx -> IO ()
+ Test.Tasty.Checklist: checkValues :: forall dType (idx :: Ctx Type). (CanCheck, TestShow dType) => dType -> Assignment (DerivedVal dType) idx -> IO ()
- Test.Tasty.Checklist: testShow :: (TestShow v, Show v) => v -> String
+ Test.Tasty.Checklist: testShow :: TestShow v => v -> String
- Test.Tasty.Checklist: type CanCheck = (?checker :: IORef [CheckResult])
+ Test.Tasty.Checklist: type CanCheck = ?checker :: IORef [CheckResult]
Files
- CHANGELOG.md +9/−0
- src/Test/Tasty/Checklist.hs +33/−13
- tasty-checklist.cabal +2/−2
CHANGELOG.md view
@@ -1,6 +1,15 @@ # Revision history for tasty-checklist +## 1.0.8.0 -- 2025-10-25++ * Limit diff output to 100 lines and align output.++## 1.0.7.0 -- 2025-10-24++ * Update constraints and flake to support GHC 8.10 -- GHC 9.12.+ ## 1.0.6.0 -- 2023-04-14+ * Update output formatting to show common input trigger only once for a group of check failures rather than on each failure. * Small formatting updates to check failure messages.
src/Test/Tasty/Checklist.hs view
@@ -97,8 +97,15 @@ -- n.b. msg might be carefully crafted to preceed chkval chkval = case onValue of Nothing -> ""- Just i -> "\n using: " <> T.unpack (inputAsText i)- in "Failed " <> chknm <> chkmsg <> chkval+ Just i -> "\n" <> indent <> "using:"+ <> indent <> T.unpack (inputAsText i)+ in if or [ length chknm > 100+ , length chkmsg > 100+ , length chkval > 100+ ]+ then replicate 50 '#' <> "\n\n" <> indent+ <> "Failed " <> chknm <> chkmsg <> chkval+ else "Failed " <> chknm <> chkmsg <> chkval show (CheckMessage txt) = "-- " <> T.unpack txt instance Show ChecklistFailures where@@ -111,6 +118,12 @@ <> show checkCnt <> " checks failed in this checklist:\n -" <> List.intercalate "\n -" (show <$> fails) +indent :: String+indent = " "++indenT :: Text+indenT = T.pack indent+ -- | A convenient Constraint to apply to functions that will perform -- checks (i.e. call 'check' one or more times) @@ -165,6 +178,7 @@ -- 2 checks failed in this checklist: -- -Failed check 'two is odd' with: 2 -- -Failed check '7 + 3 is odd' with: 10+-- ... -- <BLANKLINE> -- 1 out of 1 tests failed (...s) -- *** Exception: ExitFailure 1@@ -282,14 +296,15 @@ -- 3 checks failed in this checklist: -- --- Input for below: The answer to the universe is 18? -- -Failed check: foo--- expected: 42--- failed with: 18+-- expected: 42+-- failed with: 18 -- -Failed check: shown--- expected: "The answer to the universe is 42!"--- failed with: "The answer to the universe is 18?"+-- expected: "The answer to the universe is 42!"+-- failed with: "The answer to the universe is 18?" -- -Failed check: double-checking foo--- expected: 42--- failed with: 18+-- expected: 42+-- failed with: 18+-- ... -- <BLANKLINE> -- 1 out of 1 tests failed (...s) -- *** Exception: ExitFailure 1@@ -321,8 +336,11 @@ $ FailureMessage "<< ^^ above input ^^ >>" else CheckFailed nm Nothing fmsg dropInput i@(CheckMessage _) = i+ dispInput i = if T.length (inputAsText i) > 100+ then inputAsText i <> "\n\n"+ else inputAsText i grpTitle = maybe "<no input identified>"- (("Input for below: " <>) . inputAsText)+ (("Input for below: " <>) . dispInput) mbi in (<> (newChks <> [CheckMessage grpTitle])) in foldr addGroup mempty $ Map.toList gmap@@ -337,10 +355,12 @@ let ti = Just $ InputAsText $ T.pack $ testShow got in \case (Val txt fld v) ->- let msg = txt- <> "\n"- <> " " <> "expected: " <> tv <> "\n"- <> " " <> "failed"+ let msg =+ if T.length txt > 100+ then txt <> "\n\n" <> expline <> "\n\n" <> failedpfx+ else txt <> "\n" <> expline <> failedpfx+ expline = indenT <> " expected: " <> tv <> "\n"+ failedpfx = indenT <> " failed" tv = T.pack (testShow v) in checkShow testShow ti msg (v ==) $ fld got (Observe txt fld v observationReport) ->
tasty-checklist.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: tasty-checklist-version: 1.0.6.0+version: 1.0.8.0 synopsis: Check multiple items during a tasty test description: Allows the test to check a number of items during a test and@@ -71,7 +71,7 @@ main-is: DocTestChecklist.hs build-depends: base , HUnit- , doctest >= 0.10 && < 0.22+ , doctest >= 0.10 && < 0.25 , parameterized-utils , tasty , tasty-checklist