Skip to content

Commit

Permalink
Only compare on secons in parse & format test, fix #36
Browse files Browse the repository at this point in the history
The format function ignores `utMicroSeconds` and the parse function
always initializes `utMicroSeconds` to 0. So we can't expect the original
value here, that information is lost.
  • Loading branch information
archblob committed Sep 5, 2016
1 parent 785e792 commit a78d91d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/UnixTimeSpec.hs
Expand Up @@ -5,6 +5,7 @@ module UnixTimeSpec (main, spec) where

import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as BS
import Data.Function (on)
import Data.Time
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Data.UnixTime
Expand Down Expand Up @@ -51,7 +52,7 @@ spec = do
prop "inverses the result (2)" $ \ut ->
let str = formatUnixTimeGMT "%s" ut
ut' = parseUnixTimeGMT "%s" str
in ut == ut'
in ((==) `on` utSeconds) ut ut'

describe "addUnixDiffTime & diffUnixTime" $
prop "invrses the result" $ \(ut0, ut1) ->
Expand Down

0 comments on commit a78d91d

Please sign in to comment.