on master help sign in
add negative test for leap seconds
9f5edebAdam Schønemann
stack-lts6.yaml+1−1
@@ -3,7 +3,6 @@ packages:
3- '.'
3- '.'
4- attoparsec-iso8601
4- attoparsec-iso8601
5extra-deps:
5extra-deps:
6−- integer-logarithms-1
7- semigroups-0.18.2
6- semigroups-0.18.2
8- tagged-0.8.5
7- tagged-0.8.5
9- transformers-compat-0.5.1.4
8- transformers-compat-0.5.1.4
@@ -13,6 +12,7 @@ extra-deps:
13- integer-logarithms-1
12- integer-logarithms-1
14- quickcheck-instances-0.3.16
13- quickcheck-instances-0.3.16
15- th-abstraction-0.2.2.0
14- th-abstraction-0.2.2.0
15+- text-1.2.3.0
16flags:
16flags:
17flags:
17flags:
18 aeson:
18 aeson:
stack-lts7.yaml+1
@@ -9,6 +9,7 @@ extra-deps:
9- integer-logarithms-1
9- integer-logarithms-1
10- quickcheck-instances-0.3.16
10- quickcheck-instances-0.3.16
11- th-abstraction-0.2.2.0
11- th-abstraction-0.2.2.0
12+- text-1.2.3.0
12flags:
13flags:
13 aeson:
14 aeson:
14 fast: true
15 fast: true
tests/UnitTests.hs+2−1
@@ -198,7 +198,7 @@ utcTimeGood = do
198 assertEqual "utctime" (parseWithRead "%FT%H:%MZ" ts10) t10
198 assertEqual "utctime" (parseWithRead "%FT%H:%MZ" ts10) t10
199 assertEqual "utctime" (parseWithRead "%F %H:%MZ" ts11) t11
199 assertEqual "utctime" (parseWithRead "%F %H:%MZ" ts11) t11
200 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t12
200 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t12
201−
201+
202 -- leap seconds are included correctly
202 -- leap seconds are included correctly
203 let ts13 = "2015-08-23T23:59:60.128+00" :: LT.Text
203 let ts13 = "2015-08-23T23:59:60.128+00" :: LT.Text
204 let (Just (t13 :: UTCTime)) = parseWithAeson ts13
204 let (Just (t13 :: UTCTime)) = parseWithAeson ts13
@@ -226,6 +226,7 @@ utcTimeBad = do
226 verifyFailParse "2015-01-01T12:30:00.00+00:00Z" -- no Zulu if offset given
226 verifyFailParse "2015-01-01T12:30:00.00+00:00Z" -- no Zulu if offset given
227 verifyFailParse "2015-01-03 12:13:00.Z" -- decimal at the end but no digits
227 verifyFailParse "2015-01-03 12:13:00.Z" -- decimal at the end but no digits
228 verifyFailParse "2015-01-03 12:13.000Z" -- decimal at the end, but no seconds
228 verifyFailParse "2015-01-03 12:13.000Z" -- decimal at the end, but no seconds
229+ verifyFailParse "2015-01-03 23:59:61Z" -- exceeds allowed seconds per day
229 where
230 where
230 verifyFailParse (s :: LT.Text) =
231 verifyFailParse (s :: LT.Text) =
231 let (dec :: Maybe UTCTime) = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""] in
232 let (dec :: Maybe UTCTime) = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""] in