on master help sign in
add negative test for leap seconds
commit9f5edebaa5f9cac923565e405872dcac07bec71e authorAdam Schønemann <adamschoenemann@gmail.com> dateWed 12 Sep 2018, 15:02 (8 years ago) parent1a06b96
3 files changed+4−2
stack-lts6.yaml+1−1 stack-lts7.yaml+1 tests/UnitTests.hs+2−1
stack-lts6.yaml+1−1
@@ -3,7 +3,6 @@ packages:
33- '.'
44- attoparsec-iso8601
55extra-deps:
6−- integer-logarithms-1
76- semigroups-0.18.2
87- tagged-0.8.5
98- transformers-compat-0.5.1.4
@@ -13,6 +12,7 @@ extra-deps:
1312- integer-logarithms-1
1413- quickcheck-instances-0.3.16
1514- th-abstraction-0.2.2.0
15+- text-1.2.3.0
1616flags:
1717flags:
1818 aeson:
stack-lts7.yaml+1
@@ -9,6 +9,7 @@ extra-deps:
99- integer-logarithms-1
1010- quickcheck-instances-0.3.16
1111- th-abstraction-0.2.2.0
12+- text-1.2.3.0
1213flags:
1314 aeson:
1415 fast: true
tests/UnitTests.hs+2−1
@@ -198,7 +198,7 @@ utcTimeGood = do
198198 assertEqual "utctime" (parseWithRead "%FT%H:%MZ" ts10) t10
199199 assertEqual "utctime" (parseWithRead "%F %H:%MZ" ts11) t11
200200 assertEqual "utctime" (parseWithRead "%FT%T%QZ" "2015-01-01T14:30:00Z") t12
201−
201+
202202 -- leap seconds are included correctly
203203 let ts13 = "2015-08-23T23:59:60.128+00" :: LT.Text
204204 let (Just (t13 :: UTCTime)) = parseWithAeson ts13
@@ -226,6 +226,7 @@ utcTimeBad = do
226226 verifyFailParse "2015-01-01T12:30:00.00+00:00Z" -- no Zulu if offset given
227227 verifyFailParse "2015-01-03 12:13:00.Z" -- decimal at the end but no digits
228228 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
229230 where
230231 verifyFailParse (s :: LT.Text) =
231232 let (dec :: Maybe UTCTime) = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""] in