unix-time 0.1.5 → 0.1.6
raw patch · 3 files changed
+12/−11 lines, 3 filesdep ~hspecPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hspec
API changes (from Hackage documentation)
Files
- Data/UnixTime.hs +1/−1
- test/UnixTimeSpec.hs +9/−8
- unix-time.cabal +2/−2
Data/UnixTime.hs view
@@ -8,7 +8,7 @@ , parseUnixTimeGMT , formatUnixTime , formatUnixTimeGMT- -- * Fromat+ -- * Format , Format , webDateFormat , mailDateFormat
test/UnixTimeSpec.hs view
@@ -1,19 +1,21 @@ {-# LANGUAGE OverloadedStrings, FlexibleInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -module UnixTimeSpec where+module UnixTimeSpec (main, spec) where import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as BS import Data.Time import Data.Time.Clock.POSIX (posixSecondsToUTCTime) import Data.UnixTime-import System.IO.Unsafe (unsafePerformIO) import System.Locale (defaultTimeLocale) import Test.Hspec import Test.Hspec.QuickCheck (prop) import Test.QuickCheck +main :: IO ()+main = hspec spec+ instance Arbitrary UnixTime where arbitrary = do a <- choose (0,4294967295) :: Gen Int@@ -24,16 +26,15 @@ } return ut -currentTimeZone :: TimeZone-currentTimeZone = unsafePerformIO getCurrentTimeZone- spec :: Spec spec = do describe "formatUnixTime" $- prop "behaves like the model" $ \ut ->+ prop "behaves like the model" $ \ut -> do let ours = formatUnixTime mailDateFormat ut- model = formatMailModel (toUTCTime ut) currentTimeZone- in ours == model+ utcTime = toUTCTime ut+ timeZone <- getTimeZone utcTime+ let model = formatMailModel utcTime timeZone+ ours `shouldBe` model describe "parseUnixTimeGMT & formatUnixTimeGMT" $ prop "inverses the result" $ \ut@(UnixTime sec _) ->
unix-time.cabal view
@@ -1,5 +1,5 @@ Name: unix-time-Version: 0.1.5+Version: 0.1.6 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3@@ -43,7 +43,7 @@ Other-Modules: UnixTimeSpec Build-Depends: base , bytestring- , hspec+ , hspec >= 1.5 , old-locale , old-time , QuickCheck