@@ -99,10 +99,6 @@ tests = testGroup "unit" [
99 testCase "good" $ utcTimeGood
99 testCase "good" $ utcTimeGood
100 , testCase "bad" $ utcTimeBad
100 , testCase "bad" $ utcTimeBad
103− testCase "encode normal" $ dayEncodeCE
104− , testCase "encode BCE" $ dayEncodeBCE
106 , testGroup "formatError" [
102 , testGroup "formatError" [
107 testCase "example 1" $ formatErrorExample
103 testCase "example 1" $ formatErrorExample
@@ -246,20 +242,6 @@ utcTimeBad = do
246 let (dec :: Maybe UTCTime) = decode . LT.encodeUtf8 $ (LT.concat ["\"", s, "\""]) in
242 let (dec :: Maybe UTCTime) = decode . LT.encodeUtf8 $ (LT.concat ["\"", s, "\""]) in
247 assertEqual "verify failure" Nothing dec
243 assertEqual "verify failure" Nothing dec
249−dayEncodeCE :: Assertion
251− let ceDay = fromGregorian 1234 12 5
252− assertEqual "Encode a CE day works appropriately" (encode ceDay) "\"1234-12-05\""
254−dayEncodeBCE :: Assertion
256− let zeroDay = fromGregorian 0 6 11
257− bceDay = fromGregorian (-100) 5 13
258− wayEarly = fromGregorian (-10000) 3 3
259− assertEqual "Encode a zero year day works appropriately" (encode zeroDay) "\"0000-06-11\""
260− assertEqual "Encode a BCE day works appropriately" (encode bceDay) "\"-0100-05-13\""
261− assertEqual "Encode a really early day works appropriately" (encode wayEarly) "\"-10000-03-03\""
263-- Non identifier keys should be escaped & enclosed in brackets
245-- Non identifier keys should be escaped & enclosed in brackets
264formatErrorExample :: Assertion
246formatErrorExample :: Assertion
265formatErrorExample =
247formatErrorExample =
@@ -410,6 +392,12 @@ jsonExamples =
410 , Example "Maybe String" "\"foo\"" (pure "foo" :: Maybe String)
392 , Example "Maybe String" "\"foo\"" (pure "foo" :: Maybe String)
411 , Example "Maybe [Identity Char]" "\"xy\"" (pure [pure 'x', pure 'y'] :: Maybe [Identity Char])
393 , Example "Maybe [Identity Char]" "\"xy\"" (pure [pure 'x', pure 'y'] :: Maybe [Identity Char])
395+ , Example "Day; year >= 1000" "\"1999-10-12\"" (fromGregorian 1999 10 12)
396+ , Example "Day; year > 0 && < 1000" "\"0500-03-04\"" (fromGregorian 500 3 4)
397+ , Example "Day; year == 0" "\"0000-02-20\"" (fromGregorian 0 2 20)
398+ , Example "Day; year < 0" "\"-0234-01-01\"" (fromGregorian (-234) 1 1)
399+ , Example "Day; year < -1000" "\"-1234-01-01\"" (fromGregorian (-1234) 1 1)
413 , Example "Product I Maybe Int" "[1,2]" (Pair (pure 1) (pure 2) :: Product I Maybe Int)
401 , Example "Product I Maybe Int" "[1,2]" (Pair (pure 1) (pure 2) :: Product I Maybe Int)
414 , Example "Product I Maybe Int" "[1,null]" (Pair (pure 1) Nothing :: Product I Maybe Int)
402 , Example "Product I Maybe Int" "[1,null]" (Pair (pure 1) Nothing :: Product I Maybe Int)
415 , Example "Product I [] Char" "[\"a\",\"foo\"]" (Pair (pure 'a') "foo" :: Product I [] Char)
403 , Example "Product I [] Char" "[\"a\",\"foo\"]" (Pair (pure 'a') "foo" :: Product I [] Char)