packages feed

http-date 0.0.2 → 0.0.3

raw patch · 6 files changed

+53/−55 lines, 6 filesdep +doctestdep +hspecdep −HUnitdep −test-framework-doctestdep −test-framework-hunitdep ~basePVP ok

version bump matches the API change (PVP)

Dependencies added: doctest, hspec

Dependencies removed: HUnit, test-framework-doctest, test-framework-hunit, test-framework-th-prime

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

Network/HTTP/Date/Parser.hs view
@@ -3,6 +3,7 @@ module Network.HTTP.Date.Parser (parseHTTPDate) where  import Control.Applicative+import Control.Monad import Data.Attoparsec import Data.Attoparsec.Char8 import Data.ByteString@@ -25,12 +26,12 @@ rfc1123Date :: Parser HTTPDate rfc1123Date = do     w <- wkday-    string ", "+    void $ string ", "     (y,m,d) <- date1     sp     (h,n,s) <- time     sp-    string "GMT"+    void $ string "GMT"     return $ defaultHTTPDate {         hdYear   = y       , hdMonth  = m@@ -68,9 +69,9 @@ time :: Parser (Int,Int,Int) time = do     h <- digit2-    char ':'+    void $ char ':'     m <- digit2-    char ':'+    void $ char ':'     s <- digit2     return (h,m,s) 
http-date.cabal view
@@ -1,5 +1,5 @@ Name:                   http-date-Version:                0.0.2+Version:                0.0.3 Author:                 Kazu Yamamoto <kazu@iij.ad.jp> Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp> License:                BSD3@@ -11,10 +11,7 @@ Build-Type:             Simple  Library-  if impl(ghc >= 6.12)-    GHC-Options:        -Wall -fno-warn-unused-do-bind-  else-    GHC-Options:        -Wall+  GHC-Options:          -Wall   Exposed-Modules:      Network.HTTP.Date   Other-Modules:        Network.HTTP.Date.Converter                         Network.HTTP.Date.Formatter@@ -25,21 +22,27 @@                       , attoparsec                       , bytestring -Test-Suite test+Test-Suite spec   Type:                 exitcode-stdio-1.0   HS-Source-Dirs:       test-  Main-Is:              Test.hs-  Other-Modules:        Model+  Main-Is:              Spec.hs+  Other-Modules:        DateSpec+                        Model   Build-Depends:        base >= 4 && < 5                       , bytestring+                      , hspec                       , http-date                       , old-locale                       , time-                      , HUnit-                      , test-framework-doctest-                      , test-framework-hunit-                      , test-framework-th-prime +Test-Suite doctests+  Type:                 exitcode-stdio-1.0+  HS-Source-Dirs:       test+  Ghc-Options:          -threaded+  Main-Is:              doctests.hs+  Build-Depends:        base+                      , doctest >= 0.8+ Source-Repository head   Type:                 git-  Location:             git clone git://github.com/kazu-yamamoto/http-date+  Location:             git://github.com/kazu-yamamoto/http-date
+ test/DateSpec.hs view
@@ -0,0 +1,25 @@+module DateSpec where++import Control.Monad+import Model+import Network.HTTP.Date+import Test.Hspec++----------------------------------------------------------------++spec :: Spec+spec = do+    describe "formatHTTPDat" $ do+        it "behaves like the model" $ +            forM_ [0,100000..10000000000] $ \epochtime -> do+                let m = model epochtime+                    o = ours epochtime+                    model = utcToDate . epochTimeToUtcTime+                    ours  = formatHTTPDate . epochTimeToHTTPDate+                o `shouldBe` m+    describe "parseHTTPDate" $ do+        it "behaves like the model" $ +            forM_ [0,100000..10000000000] $ \epochtime -> do+                let m = epochTimeToHTTPDate epochtime+                    Just o = parseHTTPDate $ formatHTTPDate m+                o `shouldBe` m
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
− test/Test.hs
@@ -1,38 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}--module Main where--import Control.Monad-import Model-import Network.HTTP.Date-import Test.Framework.Providers.DocTest-import Test.Framework.Providers.HUnit-import Test.Framework.TH.Prime-import Test.HUnit--main :: IO ()-main = $(defaultMainGenerator)--------------------------------------------------------------------doc_test :: DocTests-doc_test = docTest ["Network/HTTP/Date"] ["-XOverloadedStrings"]--------------------------------------------------------------------case_formatHTTPDate :: Assertion-case_formatHTTPDate = do-    forM_ [0,100000..10000000000] $ \epochtime -> do-        let m = model epochtime-            o = ours epochtime-        o @?= m-  where-    model = utcToDate . epochTimeToUtcTime-    ours  = formatHTTPDate . epochTimeToHTTPDate--case_parseHTTPDate :: Assertion-case_parseHTTPDate = do-    forM_ [0,100000..10000000000] $ \epochtime -> do-        let m = epochTimeToHTTPDate epochtime-            Just o = parseHTTPDate $ formatHTTPDate m-        o @?= m
+ test/doctests.hs view
@@ -0,0 +1,6 @@+module Main where++import Test.DocTest++main :: IO ()+main = doctest ["-XOverloadedStrings", "Network/HTTP/Date.hs"]