@@ -57,6 +57,10 @@ main = defaultMain $ testGroup "text-iso8601"
57
57
-- ISO8601 allows various offsets, while RFC3339 only +-HH:MM
58
58
, accepts T. parseUTCTime " 1990-12-31T15:59:60-0800" -- no colon
59
59
, accepts T. parseUTCTime " 1990-12-31T15:59:60-08" -- just hour
60
+
61
+ -- accepts +23:59
62
+ , accepts T. parseUTCTime " 1937-01-01T12:00:00+23:59"
63
+ , accepts T. parseUTCTime " 1937-01-01T12:00:00-23:59"
60
64
]
61
65
62
66
, testGroup " rejected"
@@ -70,6 +74,10 @@ main = defaultMain $ testGroup "text-iso8601"
70
74
-- RFC3339 says we MAY limit, i.e. requiring they should be uppercase.
71
75
, rejects T. parseUTCTime " 2023-06-09T02:35:33z"
72
76
, rejects T. parseUTCTime " 2023-06-09t02:35:33Z"
77
+
78
+ -- accepts +23:59, but not 24 or 60
79
+ , rejects T. parseUTCTime " 1937-01-01T12:00:00+24:59"
80
+ , rejects T. parseUTCTime " 1937-01-01T12:00:00-23:60"
73
81
]
74
82
]
75
83
@@ -91,13 +99,13 @@ roundtrip eq build parse = testProperty (show (typeRep (Proxy :: Proxy a))) $ \x
91
99
property (liftEq eq y (Right x))
92
100
93
101
rejects :: forall a . (Typeable a , Show a ) => (Text -> Either String a ) -> String -> TestTree
94
- rejects parse inp = testCase (show (typeRep (Proxy :: Proxy a )) ++ " accepts " ++ show inp) $ do
102
+ rejects parse inp = testCase (show (typeRep (Proxy :: Proxy a )) ++ " rejects " ++ show inp) $ do
95
103
case parse (T. pack inp) of
96
104
Left _ -> return ()
97
105
Right a -> assertFailure $ " Unexpectedly accepted: " ++ show a
98
106
99
107
accepts :: forall a . (Typeable a , Show a ) => (Text -> Either String a ) -> String -> TestTree
100
- accepts parse inp = testCase (show (typeRep (Proxy :: Proxy a )) ++ " rejects " ++ show inp) $ do
108
+ accepts parse inp = testCase (show (typeRep (Proxy :: Proxy a )) ++ " accepts " ++ show inp) $ do
101
109
case parse (T. pack inp) of
102
110
Left err -> assertFailure $ " Unexpectedly rejected: " ++ err
103
111
Right _ -> return ()
0 commit comments