[commit: packages/time] master: .Format.Parse: fix spaces parsing (f964074)

git at git.haskell.org git at git.haskell.org
Sun Dec 20 07:55:03 UTC 2015


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

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

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

commit f964074acda92566bc15e25f31bb5c752b17c002
Author: Ashley Yakeley <ashley at yakeley.org>
Date:   Mon Aug 18 02:03:25 2014 -0700

    .Format.Parse: fix spaces parsing


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

f964074acda92566bc15e25f31bb5c752b17c002
 lib/Data/Time/Format/Parse.hs | 2 +-
 test/Test/TestParseTime.hs    | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs
index e750f9a..5b0b762 100644
--- a/lib/Data/Time/Format/Parse.hs
+++ b/lib/Data/Time/Format/Parse.hs
@@ -131,7 +131,7 @@ readPTime :: ParseTime t =>
           -> String     -- ^ Format string
           -> ReadP t
 readPTime False l f = readPOnlyTime l f
-readPTime True l f = readPOnlyTime l f <++ (skipSpaces >> readPOnlyTime l f)
+readPTime True l f = (skipSpaces >> readPOnlyTime l f) <++ readPOnlyTime l f
 
 -- | Parse a time value given a format string (without allowing leading whitespace).  See 'parseTimeM' for details.
 readPOnlyTime :: ParseTime t =>
diff --git a/test/Test/TestParseTime.hs b/test/Test/TestParseTime.hs
index 0fb9711..b0e9ef2 100644
--- a/test/Test/TestParseTime.hs
+++ b/test/Test/TestParseTime.hs
@@ -147,9 +147,13 @@ particularParseTests :: Test
 particularParseTests = testGroup "particular"
     [
         spacingTests epoch "%Q" "",
+        spacingTests epoch "%Q" ".0",
         spacingTests epoch "%k" " 0",
         spacingTests epoch "%M" "00",
-        spacingTests (TimeZone 120 False "") "%Z" "+0200"
+        spacingTests epoch "%m" "01",
+        spacingTests (TimeZone 120 False "") "%z" "+0200",
+        spacingTests (TimeZone 120 False "") "%Z" "+0200",
+        spacingTests (TimeZone (-480) False "PST") "%Z" "PST"
     ]
 
 parseYMD :: Day -> Test



More information about the ghc-commits mailing list