sydtest 0.13.0.1 → 0.13.0.2
raw patch · 5 files changed
+44/−31 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- src/Test/Syd/OptParse.hs +2/−1
- src/Test/Syd/Output.hs +10/−4
- sydtest.cabal +2/−2
- test_resources/output-test.txt +24/−24
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Changelog +## [0.13.0.2] - 2023-03-24++### Changed++* Improved white space diffing+ ## [0.13.0.1] - 2023-01-13 ### Changed
src/Test/Syd/OptParse.hs view
@@ -603,7 +603,8 @@ auto ( mconcat [ long "retries",- help "The number of retries to use for flakiness diagnostics. 0 means 'no flakiness diagnostics'"+ help "The number of retries to use for flakiness diagnostics. 0 means 'no flakiness diagnostics'",+ metavar "INTEGER" ] ) )
src/Test/Syd/Output.hs view
@@ -467,11 +467,17 @@ [cs] -> [header : cs] -- If there is more than one line, put the header on a separate line before cs -> [header] : cs++ -- If it's only whitespace, change the background, otherwise change the foreground+ foreOrBack :: Colour -> Text -> Chunk+ foreOrBack c t =+ (if T.null (T.strip t) then back c else fore c)+ (chunk t) actualChunks :: [[Chunk]] actualChunks = chunksLinesWithHeader (fore blue "Actual: ") $ splitChunksIntoLines $ flip mapMaybe diff $ \case- First t -> Just $ fore red $ chunk t+ First t -> Just $ foreOrBack red t Second _ -> Nothing Both t _ -> Just $ chunk t expectedChunks :: [[Chunk]]@@ -479,7 +485,7 @@ splitChunksIntoLines $ flip mapMaybe diff $ \case First _ -> Nothing- Second t -> Just $ fore green $ chunk t+ Second t -> Just $ foreOrBack green t Both t _ -> Just $ chunk t inlineDiffChunks :: [[Chunk]] inlineDiffChunks =@@ -488,8 +494,8 @@ else chunksLinesWithHeader (fore blue "Inline diff: ") $ splitChunksIntoLines $ flip map diff $ \case- First t -> fore red $ chunk t- Second t -> fore green $ chunk t+ First t -> foreOrBack red t+ Second t -> foreOrBack green t Both t _ -> chunk t in concat [ [[chunk "Expected these values to be equal:"]],
sydtest.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: sydtest-version: 0.13.0.1+version: 0.13.0.2 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@@ -13,7 +13,7 @@ bug-reports: https://github.com/NorfairKing/sydtest/issues author: Tom Sydney Kerckhove maintainer: syd@cs-syd.eu-copyright: Copyright (c) 2020-2022 Tom Sydney Kerckhove+copyright: Copyright (c) 2020-2023 Tom Sydney Kerckhove license: OtherLicense license-file: LICENSE.md build-type: Simple
test_resources/output-test.txt view
@@ -518,8 +518,8 @@ , [31m1[m[31m9[m ] [34mExpected: [m- [ -[32m5[m[32m[m- [32m[m[32m, [m[32m3[m+ [ -[32m5[m[42m[m+ [42m[m[32m, [m[32m3[m , 1[32m1[m , -3 , -1[32m3[m@@ -539,8 +539,8 @@ , [32m-6[m ] [34mInline diff: [m- [ -[32m5[m[32m[m- [32m[m[32m, [m[31m1[m[32m3[m[31m8[m+ [ -[32m5[m[42m[m+ [42m[m[32m, [m[31m1[m[32m3[m[31m8[m , [31m-[m1[32m1[m[31m3[m , -[31m1[m3 , -1[32m3[m[31m2[m@@ -567,7 +567,7 @@ Expected these values to be equal: [34mActual: [m ( "foo"- , [[31m [m[31m"qu[m[31mux[m[31m"[m [31m,[m[31m [m"quux" , "quux" , "quux" , "quux" , "quux" , "quux" ]+ , [[41m [m[31m"qu[m[31mux[m[31m"[m [31m,[m[41m [m"quux" , "quux" , "quux" , "quux" , "quux" , "quux" ] , "ba[31mr[m" ) [34mExpected: [m@@ -577,7 +577,7 @@ ) [34mInline diff: [m ( "[32mf[m[32mo[m[32mo[mfoo"- , [[31m [m[31m"qu[m[31mux[m[31m"[m [31m,[m[31m [m"quux" , "quux" , "quux" , "quux" , "quux" , "quux" ]+ , [[41m [m[31m"qu[m[31mux[m[31m"[m [31m,[m[41m [m"quux" , "quux" , "quux" , "quux" , "quux" , "quux" ] , "ba[32mz[m[31mr[m" ) @@ -585,17 +585,17 @@ [31m✗ [m[31m33 [m[31mDiff.shows nice multi-line diffs[m Retries: 3 (does not look flaky) Expected these values to be equal:- [34mActual: [m( "foo"[31m [m, [[31m][m , "ba[31mr[m"[31m [m)+ [34mActual: [m( "foo"[41m [m, [[31m][m , "ba[31mr[m"[41m [m) [34mExpected: [m- ( "[32mf[m[32mo[m[32mo[mfoo"[32m[m- [32m[m, [[32m "[m[32mquux" , [m[32m"quux" , "quux" [m[32m, "quux" , "quux[m[32m" , "quu[m[32mx"[m [32m][m- [32m[m, "ba[32mz[m"[32m[m- [32m[m)+ ( "[32mf[m[32mo[m[32mo[mfoo"[42m[m+ [42m[m, [[32m "[m[32mquux" , [m[32m"quux" , "quux" [m[32m, "quux" , "quux[m[32m" , "quu[m[32mx"[m [32m][m+ [32m[m, "ba[32mz[m"[42m[m+ [42m[m) [34mInline diff: [m- ( "[32mf[m[32mo[m[32mo[mfoo"[31m [m[32m[m- [32m[m, [[31m][m[32m "[m[32mquux" , [m[32m"quux" , "quux" [m[32m, "quux" , "quux[m[32m" , "quu[m[32mx"[m [32m][m- [32m[m, "ba[31mr[m[32mz[m"[31m [m[32m[m- [32m[m)+ ( "[32mf[m[32mo[m[32mo[mfoo"[41m [m[42m[m+ [42m[m, [[31m][m[32m "[m[32mquux" , [m[32m"quux" , "quux" [m[32m, "quux" , "quux[m[32m" , "quu[m[32mx"[m [32m][m+ [32m[m, "ba[31mr[m[32mz[m"[41m [m[42m[m+ [42m[m) [36m output-test/Spec.hs:95[m [31m✗ [m[31m34 [m[31massertions.shouldBe[m@@ -705,7 +705,7 @@ [31m✗ [m[31m53 [m[31mString.compares strings[m Retries: 3 (does not look flaky) Expected these values to be equal:- [34mActual: [m"f[31mo[mo\nba[31mr[m\tq[31muu[mx[31m [m"+ [34mActual: [m"f[31mo[mo\nba[31mr[m\tq[31muu[mx[41m [m" [34mExpected: [m"fo[32mq[m\nba[32mz[m\tq[32me[mx" [36m output-test/Spec.hs:191[m@@ -714,19 +714,19 @@ Expected these values to be equal: [34mActual: [m f[31mo[mo- ba[31mr[m q[31muu[mx[31m [m+ ba[31mr[m q[31muu[mx[41m [m [34mExpected: [m fo[32mq[m ba[32mz[m q[32me[mx [34mInline diff: [m f[31mo[mo[32mq[m- ba[31mr[m[32mz[m q[31muu[m[32me[mx[31m [m+ ba[31mr[m[32mz[m q[31muu[m[32me[mx[41m [m [36m output-test/Spec.hs:192[m [31m✗ [m[31m55 [m[31mString.compares texts[m Retries: 3 (does not look flaky) Expected these values to be equal:- [34mActual: [m"f[31mo[mo\nba[31mr[m\tq[31muu[mx[31m [m"+ [34mActual: [m"f[31mo[mo\nba[31mr[m\tq[31muu[mx[41m [m" [34mExpected: [m"fo[32mq[m\nba[32mz[m\tq[32me[mx" [36m output-test/Spec.hs:193[m@@ -735,19 +735,19 @@ Expected these values to be equal: [34mActual: [m f[31mo[mo- ba[31mr[m q[31muu[mx[31m [m+ ba[31mr[m q[31muu[mx[41m [m [34mExpected: [m fo[32mq[m ba[32mz[m q[32me[mx [34mInline diff: [m f[31mo[mo[32mq[m- ba[31mr[m[32mz[m q[31muu[m[32me[mx[31m [m+ ba[31mr[m[32mz[m q[31muu[m[32me[mx[41m [m [36m output-test/Spec.hs:194[m [31m✗ [m[31m57 [m[31mString.compares bytestrings[m Retries: 3 (does not look flaky) Expected these values to be equal:- [34mActual: [m"f[31mo[mo\nba[31mr[m\tq[31muu[mx[31m [m"+ [34mActual: [m"f[31mo[mo\nba[31mr[m\tq[31muu[mx[41m [m" [34mExpected: [m"fo[32mq[m\nba[32mz[m\tq[32me[mx" [36m output-test/Spec.hs:197[m@@ -798,7 +798,7 @@ Labels: "length of input is 0", "magnitude (digits) of sum of input is 0" Expected these values to be equal: [34mActual: [m[]- [34mExpected: [m[[32m [m[32m0[m[32m [m]+ [34mExpected: [m[[42m [m[32m0[m[42m [m] [36m output-test/Spec.hs:246[m [31m✗ [m[31m63 [m[31mProperty.classes.shows the classes in use on failure[m@@ -808,7 +808,7 @@ Class: empty Expected these values to be equal: [34mActual: [m[]- [34mExpected: [m[[32m [m[32m0[m[32m [m]+ [34mExpected: [m[[42m [m[32m0[m[42m [m] [36m output-test/Spec.hs:269[m [31m✗ [m[31m64 [m[31mShrinking.can grab the mvar during shrinking[m