[commit: packages/time] format-widths, ghc, master: Merge branch 'master' into format-widths (c763435)
git at git.haskell.org
git at git.haskell.org
Fri Apr 21 16:57:06 UTC 2017
Repository : ssh://git@git.haskell.org/time
On branches: format-widths,ghc,master
Link : http://git.haskell.org/packages/time.git/commitdiff/c763435ea5abfc253b24745f1afcdeeee3c03d94
>---------------------------------------------------------------
commit c763435ea5abfc253b24745f1afcdeeee3c03d94
Merge: bd85cb0 dd86365
Author: Ashley Yakeley <ashley at yakeley.org>
Date: Sun Feb 5 23:24:00 2017 -0800
Merge branch 'master' into format-widths
>---------------------------------------------------------------
c763435ea5abfc253b24745f1afcdeeee3c03d94
test/unix/Test/Format/Format.hs | 97 +++++++++++++++++++----------------------
test/unix/Test/TestUtil.hs | 10 ++++-
2 files changed, 54 insertions(+), 53 deletions(-)
diff --cc test/unix/Test/Format/Format.hs
index 1512c77,420a70a..77ae8e4
--- a/test/unix/Test/Format/Format.hs
+++ b/test/unix/Test/Format/Format.hs
@@@ -103,27 -86,33 +86,37 @@@ chars :: [Char
chars = "aAbBcCdDeFgGhHIjklmMnprRStTuUVwWxXyYzZ%"
-- as found in "man strftime" on a glibc system. '#' is different, though
- modifiers :: [Char]
- modifiers = "_-0^"
+ modifiers :: [String]
+ modifiers = ["","_","-","0","^"]
+widths :: [String]
+widths = ["","1","2","9","12"]
+
formats :: [String]
- formats = ["%G-W%V-%u","%U-%w","%W-%u"] ++ (fmap (\char -> '%':[char]) chars)
- ++ (concat $ fmap (\char -> concat $ fmap (\width -> fmap (\modifier -> "%" ++ [modifier] ++ width ++ [char]) modifiers) widths) chars)
+ formats = ["%G-W%V-%u","%U-%w","%W-%u"]
+ ++ (do
+ char <- chars
++ width <- widths
+ modifier <- modifiers
- return $ "%" ++ modifier ++ [char]
++ return $ "%" ++ modifier ++ width ++ [char]
+ )
hashformats :: [String]
- hashformats = (fmap (\char -> '%':'#':char:[]) chars)
-
- testCompareFormat :: TestTree
- testCompareFormat = testGroup "compare format" $ tgroup formats $ \fmt -> tgroup times $ \time -> tgroup zones $ \zone -> compareFormat id fmt zone time
-
- testCompareHashFormat :: TestTree
- testCompareHashFormat = testGroup "compare hashformat" $ tgroup hashformats $ \fmt -> tgroup times $ \time -> tgroup zones $ \zone -> compareFormat (fmap toLower) fmt zone time
+ hashformats = do
+ char <- chars
+ return $ "%#"++[char]
+
+ testCompareFormat :: [TestTree]
+ testCompareFormat = tgroup formats $ \fmt -> do
+ time <- times
+ zone <- zones
+ return $ compareFormat id fmt zone time
+
+ testCompareHashFormat :: [TestTree]
+ testCompareHashFormat = tgroup hashformats $ \fmt -> do
+ time <- times
+ zone <- zones
+ return $ compareFormat (fmap toLower) fmt zone time
testFormat :: TestTree
- testFormat = testGroup "testFormat" $ [
- testCompareFormat,
- testCompareHashFormat
- ]
+ testFormat = testGroup "testFormat" $ testCompareFormat ++ testCompareHashFormat
More information about the ghc-commits
mailing list