X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=time-w3c.git;a=blobdiff_plain;f=tests%2FFormatterTest.hs;fp=tests%2FFormatterTest.hs;h=fbe2fbc26506e40deeb24c7a51d31b7e8b14d4fd;hp=0000000000000000000000000000000000000000;hb=4d1f3fc0f0050662a8c9150e0e5f039b72ada265;hpb=6f8578a5f973cf4687dbea90c7a42c008925a2ec diff --git a/tests/FormatterTest.hs b/tests/FormatterTest.hs new file mode 100644 index 0000000..fbe2fbc --- /dev/null +++ b/tests/FormatterTest.hs @@ -0,0 +1,35 @@ +module FormatterTest + ( testData + ) + where + +import Data.Time +import Data.Time.W3C +import Test.HUnit + + +testData :: [Test] +testData = [ format (W3CDateTime 2010 Nothing Nothing Nothing Nothing Nothing Nothing) + ~?= + "2010" + + , format (W3CDateTime 2010 (Just 12) Nothing Nothing Nothing Nothing Nothing) + ~?= + "2010-12" + + , format (W3CDateTime 2010 (Just 12) (Just 31) Nothing Nothing Nothing Nothing) + ~?= + "2010-12-31" + + , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) Nothing (Just utc)) + ~?= + "2010-12-31T01:23Z" + + , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) (Just 45) (Just (hoursToTimeZone 9))) + ~?= + "2010-12-31T01:23:45+09:00" + + , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) (Just 45.666666) (Just (hoursToTimeZone 9))) + ~?= + "2010-12-31T01:23:45.666666+09:00" + ]