[commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test parse %-m single digit (7cef519)

git at git.haskell.org git at git.haskell.org
Fri Apr 21 16:51:02 UTC 2017


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

On branches: format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis
Link       : http://git.haskell.org/packages/time.git/commitdiff/7cef51954de82636ac53c25858531569c0fbebbe

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

commit 7cef51954de82636ac53c25858531569c0fbebbe
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Sat May 7 22:31:58 2011 -0700

    test parse %-m single digit
    
    Ignore-this: 32fc454ea7f34c9985e4d2cab174021
    
    darcs-hash:20110508053158-ac6dd-3c4acb3124184955ea67bc432067ec40d11558a8


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

7cef51954de82636ac53c25858531569c0fbebbe
 test/TestParseTime.hs | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs
index 1d2d1c2..a8b3832 100644
--- a/test/TestParseTime.hs
+++ b/test/TestParseTime.hs
@@ -56,27 +56,22 @@ extests = [
     ("parse %C %y 2000s",MkExhaustiveTest [0..99] (parseCYY 20)),
     ("parse %C %y 1400s",MkExhaustiveTest [0..99] (parseCYY 14)),
     ("parse %C %y 700s",MkExhaustiveTest [0..99] (parseCYY 7)),
-    ("parseYearDay %Y %m %d",MkExhaustiveTest days2011 parseYearDayD),
-    ("parseYearDay %Y %m %d 0-pad",MkExhaustiveTest days2011 parseYearDayD2),
-    ("parseYearDay %Y %m %e",MkExhaustiveTest days2011 parseYearDayE),
-    ("parseYearDay %Y %m %e 0-pad",MkExhaustiveTest days2011 parseYearDayE2)
+    ("parse %Y%m%d",MkExhaustiveTest days2011 parseYMD),
+    ("parse %Y %m %d",MkExhaustiveTest days2011 parseYearDayD),
+    ("parse %Y %-m %e",MkExhaustiveTest days2011 parseYearDayE)
     ]
 
+parseYMD :: Day -> IO Bool
+parseYMD day = case toGregorian day of
+    (y,m,d) -> return $ (parse "%Y%m%d" ((show y) ++ (show2 m) ++ (show2 d))) == Just day
+
 parseYearDayD :: Day -> IO Bool
 parseYearDayD day = case toGregorian day of
-    (y,m,d) -> return $ (parse "%Y %m %d" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day
-
-parseYearDayD2 :: Day -> IO Bool
-parseYearDayD2 day = case toGregorian day of
     (y,m,d) -> return $ (parse "%Y %m %d" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))) == Just day
 
 parseYearDayE :: Day -> IO Bool
 parseYearDayE day = case toGregorian day of
-    (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day
-
-parseYearDayE2 :: Day -> IO Bool
-parseYearDayE2 day = case toGregorian day of
-    (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))) == Just day
+    (y,m,d) -> return $ (parse "%Y %-m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day
 
 -- | 1969 - 2068
 expectedYear :: Integer -> Integer



More information about the ghc-commits mailing list