@@ -74,14 +74,14 @@ tests = testGroup "unit" [
74 assertEqual "" "camel_api_case" (camelTo2 '_' "CamelAPICase")
74 assertEqual "" "camel_api_case" (camelTo2 '_' "CamelAPICase")
76 , testGroup "encoding" [
76 , testGroup "encoding" [
77− testCase "goodProducer" $ goodProducer
77+ testCase "goodProducer" goodProducer
79 , testGroup "utctime" [
79 , testGroup "utctime" [
80− testCase "good" $ utcTimeGood
80+ testCase "good" utcTimeGood
81− , testCase "bad" $ utcTimeBad
81+ , testCase "bad" utcTimeBad
83 , testGroup "formatError" [
83 , testGroup "formatError" [
84− testCase "example 1" $ formatErrorExample
84+ testCase "example 1" formatErrorExample
86 , testGroup ".:, .:?, .:!" $ fmap (testCase "-") dotColonMark
86 , testGroup ".:, .:?, .:!" $ fmap (testCase "-") dotColonMark
87 , testGroup "JSONPath" $ fmap (testCase "-") jsonPath
87 , testGroup "JSONPath" $ fmap (testCase "-") jsonPath
@@ -187,11 +187,9 @@ utcTimeGood = do
188 parseWithRead :: String -> LT.Text -> UTCTime
188 parseWithRead :: String -> LT.Text -> UTCTime
189 parseWithRead f s =
189 parseWithRead f s =
190− case parseTime defaultTimeLocale f . LT.unpack $ s of
190+ fromMaybe (error "parseTime input malformed") . parseTime defaultTimeLocale f . LT.unpack $ s
191− Nothing -> error "parseTime input malformed"
193 parseWithAeson :: LT.Text -> Maybe UTCTime
191 parseWithAeson :: LT.Text -> Maybe UTCTime
194− parseWithAeson s = decode . LT.encodeUtf8 $ (LT.concat ["\"", s, "\""])
192+ parseWithAeson s = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""]
196-- Test that a few non-timezone qualified timestamp formats get
194-- Test that a few non-timezone qualified timestamp formats get
197-- rejected if decoding to UTCTime.
195-- rejected if decoding to UTCTime.
@@ -207,7 +205,7 @@ utcTimeBad = do
207 verifyFailParse "2015-01-03 12:13.000Z" -- decimal at the end, but no seconds
205 verifyFailParse "2015-01-03 12:13.000Z" -- decimal at the end, but no seconds
209 verifyFailParse (s :: LT.Text) =
207 verifyFailParse (s :: LT.Text) =
210− let (dec :: Maybe UTCTime) = decode . LT.encodeUtf8 $ (LT.concat ["\"", s, "\""]) in
208+ let (dec :: Maybe UTCTime) = decode . LT.encodeUtf8 $ LT.concat ["\"", s, "\""] in
211 assertEqual "verify failure" Nothing dec
209 assertEqual "verify failure" Nothing dec
213-- Non identifier keys should be escaped & enclosed in brackets
211-- Non identifier keys should be escaped & enclosed in brackets
@@ -235,11 +233,11 @@ dotColonMark = [
235 , assertEqual ".: 42" (Just (T1 (Just 42))) (decode ex2 :: Maybe T1)
233 , assertEqual ".: 42" (Just (T1 (Just 42))) (decode ex2 :: Maybe T1)
236 , assertEqual ".: null" (Just (T1 Nothing)) (decode ex3 :: Maybe T1)
234 , assertEqual ".: null" (Just (T1 Nothing)) (decode ex3 :: Maybe T1)
238− , assertEqual ".:? not-present" (Just (T2 (Nothing))) (decode ex1 :: Maybe T2)
236+ , assertEqual ".:? not-present" (Just (T2 Nothing)) (decode ex1 :: Maybe T2)
239 , assertEqual ".:? 42" (Just (T2 (Just 42))) (decode ex2 :: Maybe T2)
237 , assertEqual ".:? 42" (Just (T2 (Just 42))) (decode ex2 :: Maybe T2)
240 , assertEqual ".:? null" (Just (T2 Nothing)) (decode ex3 :: Maybe T2)
238 , assertEqual ".:? null" (Just (T2 Nothing)) (decode ex3 :: Maybe T2)
242− , assertEqual ".:! not-present" (Just (T3 (Nothing))) (decode ex1 :: Maybe T3)
240+ , assertEqual ".:! not-present" (Just (T3 Nothing)) (decode ex1 :: Maybe T3)
243 , assertEqual ".:! 42" (Just (T3 (Just 42))) (decode ex2 :: Maybe T3)
241 , assertEqual ".:! 42" (Just (T3 (Just 42))) (decode ex2 :: Maybe T3)
244 , assertEqual ".:! null" Nothing (decode ex3 :: Maybe T3)
242 , assertEqual ".:! null" Nothing (decode ex3 :: Maybe T3)