From e7ac0839f2d4beb2fe79f903222e04e797a47dd4 Mon Sep 17 00:00:00 2001 From: PHO Date: Sun, 2 Oct 2011 21:52:32 +0900 Subject: [PATCH] Tests for Data.Time.RFC733 Ditz-issue: c8c594f249504e28212f18a8a5c6b8a708b99f79 --- Data/Time/RFC733/Internal.hs | 5 +++-- Test/Time/HTTP.hs | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Data/Time/RFC733/Internal.hs b/Data/Time/RFC733/Internal.hs index 9258e65..4037918 100644 --- a/Data/Time/RFC733/Internal.hs +++ b/Data/Time/RFC733/Internal.hs @@ -16,6 +16,7 @@ import Data.Monoid.Unicode import Data.Time import Data.Time.Calendar.WeekDate import Data.Time.HTTP.Common +import Data.Time.RFC822.Internal hiding (toAsciiBuilder) -- |Parse RFC 733 date and time strings. rfc733DateAndTime ∷ Parser ZonedTime @@ -134,5 +135,5 @@ toAsciiBuilder zonedTime ⊕ show2 (todMin timeOfDay) ⊕ A.toAsciiBuilder ":" ⊕ show2 (floor (todSec timeOfDay) ∷ Int) - ⊕ A.toAsciiBuilder "-" - ⊕ show4digitsTZ timeZone + ⊕ A.toAsciiBuilder " " + ⊕ showRFC822TimeZone timeZone diff --git a/Test/Time/HTTP.hs b/Test/Time/HTTP.hs index d15836a..d6f76cf 100644 --- a/Test/Time/HTTP.hs +++ b/Test/Time/HTTP.hs @@ -8,6 +8,7 @@ import Control.Applicative import Control.Applicative.Unicode import Data.Time import qualified Data.Time.Asctime as Asctime +import qualified Data.Time.RFC733 as RFC733 import qualified Data.Time.RFC1123 as RFC1123 import System.Exit import Prelude.Unicode @@ -61,6 +62,15 @@ tests = [ -- Asctime , property $ \lt → Right lt ≡ Asctime.fromAscii (Asctime.toAscii lt) + -- RFC733 + , property ( RFC733.fromAscii "Sunday, 06-Nov-94 08:49:37 GMT" + ≡ Right referenceZonedTime ) + + , property ( "Sunday, 06-Nov-1994 08:49:37 GMT" + ≡ RFC733.toAscii referenceZonedTime ) + + , property $ \zt → Right zt ≡ RFC733.fromAscii (RFC733.toAscii zt) + -- RFC1123 , property ( RFC1123.fromAscii "Sun, 06 Nov 1994 08:49:37 GMT" ≡ Right referenceZonedTime ) -- 2.40.0