[commit: packages/time] master: test for parse %m single digit (3dd4c2c)

git at git.haskell.org git at git.haskell.org
Fri Jan 23 23:00:20 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/time.git/commitdiff/3dd4c2cab3b79fb33933f5d64108e474de3f1a06

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

commit 3dd4c2cab3b79fb33933f5d64108e474de3f1a06
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Sat May 7 22:16:09 2011 -0700

    test for parse %m single digit
    
    Ignore-this: a79ecf3b70510657aca907e78c70f012
    
    darcs-hash:20110508051609-ac6dd-9ad32ef4836008a307a1de03594d405fd79daec3


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

3dd4c2cab3b79fb33933f5d64108e474de3f1a06
 test/TestParseTime.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs
index 5594f34..c8eabd2 100644
--- a/test/TestParseTime.hs
+++ b/test/TestParseTime.hs
@@ -52,9 +52,14 @@ extests = [
     ("parse %C %y 1900s",MkExhaustiveTest [0..99] (parseCYY 19)),
     ("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))
+    ("parse %C %y 700s",MkExhaustiveTest [0..99] (parseCYY 7)),
+    ("parseYearDay",MkExhaustiveTest [(fromGregorian 2011 1 1) .. (fromGregorian 2011 12 31)] parseYearDay)
     ]
 
+parseYearDay :: Day -> IO Bool
+parseYearDay day = case toGregorian day of
+    (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day
+
 -- | 1969 - 2068
 expectedYear :: Integer -> Integer
 expectedYear i | i >= 69 = 1900 + i



More information about the ghc-commits mailing list