packages feed

tasty 1.1.0.1 → 1.1.0.2

raw patch · 3 files changed

+32/−5 lines, 3 filesdep +wcwidthPVP ok

version bump matches the API change (PVP)

Dependencies added: wcwidth

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,6 +1,12 @@ Changes ======= +Version 1.1.0.2+---------------++Fix a bug where some (mostly Asian) characters would break alignment in the+terminal output+ Version 1.1.0.1 --------------- 
Test/Tasty/Ingredients/ConsoleReporter.hs view
@@ -37,6 +37,9 @@ import Text.Printf import qualified Data.IntMap as IntMap import Data.Char+#ifdef UNIX+import Data.Char.WCWidth (wcwidth)+#endif import Data.Maybe import Data.Monoid import Data.Typeable@@ -105,7 +108,7 @@       let         printTestName = do           printf "%s%s: %s" (indent level) name-            (replicate (alignment - indentSize * level - length name) ' ')+            (replicate (alignment - indentSize * level - stringWidth name) ' ')           hFlush stdout          printTestResult result = do@@ -539,13 +542,13 @@   (<>) = mappend #endif --- | Compute the amount of space needed to align "OK"s and "FAIL"s+-- | Compute the amount of space needed to align \"OK\"s and \"FAIL\"s computeAlignment :: OptionSet -> TestTree -> Int computeAlignment opts =   fromMonoid .   foldTestTree     trivialFold-      { foldSingle = \_ name _ level -> Maximum (length name + level)+      { foldSingle = \_ name _ level -> Maximum (stringWidth name + level)       , foldGroup = \_ m -> m . (+ indentSize)       }     opts@@ -554,6 +557,23 @@       case m 0 of         MinusInfinity -> 0         Maximum x -> x++-- | Compute the length/width of the string as it would appear in a monospace+--   terminal. This takes into account that even in a “mono”space font, not+--   all characters actually have the same width, in particular, most CJK+--   characters have twice the same as Western characters.+--+--   (This only works properly on Unix at the moment; on Windows, the function+--   treats every character as width-1 like 'Data.List.length' does.)+stringWidth :: String -> Int+#ifdef UNIX+stringWidth = Prelude.sum . map charWidth+ where charWidth c = case wcwidth c of+        -1 -> 1  -- many chars have "undefined" width; default to 1 for these.+        w  -> w+#else+stringWidth = length+#endif  -- (Potentially) colorful output ok, fail, infoOk, infoFail :: (?colors :: Bool) => String -> IO ()
tasty.cabal view
@@ -2,7 +2,7 @@ --  see http://haskell.org/cabal/users-guide/  name:                tasty-version:             1.1.0.1+version:             1.1.0.2 synopsis:            Modern and extensible testing framework description:         Tasty is a modern testing framework for Haskell.                      It lets you combine your unit tests, golden@@ -78,7 +78,8 @@     build-depends: ghc-prim    if !os(windows)-    build-depends: unix+    build-depends: unix,+                   wcwidth     cpp-options: -DUNIX    -- hs-source-dirs: