[commit: packages/time] format-widths: test: fix formatting "z" with widths tests (19f02fa)

git at git.haskell.org git at git.haskell.org
Mon Feb 20 21:20:55 UTC 2017


Repository : ssh://git@git.haskell.org/time

On branch  : format-widths
Link       : http://git.haskell.org/packages/time.git/commitdiff/19f02fa1b580d0e2ec7af59ca28afd6a678804a1

>---------------------------------------------------------------

commit 19f02fa1b580d0e2ec7af59ca28afd6a678804a1
Author: Ashley Yakeley <ashley at yakeley.org>
Date:   Tue Feb 7 19:48:40 2017 -0800

    test: fix formatting "z" with widths tests


>---------------------------------------------------------------

19f02fa1b580d0e2ec7af59ca28afd6a678804a1
 test/unix/Test/Format/Format.hs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs
index 1ad674b..35be9b1 100644
--- a/test/unix/Test/Format/Format.hs
+++ b/test/unix/Test/Format/Format.hs
@@ -69,6 +69,10 @@ unixWorkarounds "%_G" s = padN 4 ' ' s
 unixWorkarounds "%0G" s = padN 4 '0' s
 unixWorkarounds "%_f" s = padN 2 ' ' s
 unixWorkarounds "%0f" s = padN 2 '0' s
+unixWorkarounds fmt s | elem 'z' fmt = dropWhile isPadChar s where
+    isPadChar ' ' = True
+    isPadChar '0' = True
+    isPadChar _ = False
 unixWorkarounds _ s = s
 
 compareFormat :: (String -> String) -> String -> TimeZone -> UTCTime -> Result



More information about the ghc-commits mailing list