packages feed

time-recurrence 0.9.2 → 0.9.3

raw patch · 3 files changed

+48/−21 lines, 3 filesdep ~HUnitdep ~time

Dependency ranges changed: HUnit, time

Files

AUTHORS view
@@ -1,1 +1,7 @@ Initial hacking done by Chris Heller <hellertime@gmail.com>.++Additional contributions by:++Conrad Parker <conrad@metadecks.org>+Philip Cunningham <philip@irisconnect.co.uk>+Stephen Diehl <stephen.m.diehl@gmail.com>
tests/Tests.lhs view
@@ -1,3 +1,5 @@+> {-# LANGUAGE CPP #-}+ HUnut test suite of example recurrences lifted from RFC 5545 section 3.8.5.3  > module Main where@@ -13,21 +15,32 @@ a local time instance has not been created yet, all the dates are converted into UTC. -> import System.Locale (defaultTimeLocale, rfc822DateFormat)+#if MIN_VERSION_time(1,5,0) > import Data.Time-> import Data.Maybe (fromJust)+#else+> import Data.Time+> import System.Locale (TimeLocale, defaultTimeLocale, rfc822DateFormat)+#endif +> import Data.Maybe (fromJust) > import Prelude hiding (until, filter) > import Data.Time.Recurrence +> timeParse :: ParseTime t => TimeLocale -> String -> String -> Maybe t+#if MIN_VERSION_time(1,5,0)+> timeParse = parseTimeM True+#else+> timeParse = parseTime+#endif+ We are certain of the validity of the dates used, and so fromJust is safe to use.  > date1, date2, date3, date4 :: UTCTime > parse822Time :: String -> UTCTime-> parse822Time = zonedTimeToUTC ->              . fromJust ->              . parseTime defaultTimeLocale rfc822DateFormat+> parse822Time = zonedTimeToUTC+>              . fromJust+>              . timeParse defaultTimeLocale rfc822DateFormat > date1 = parse822Time "Tue, 02 Sep 1997 09:00:00 -0400" > date2 = parse822Time "Wed, 24 Dec 1997 00:00:00 -0400" > date3 = parse822Time "Thu, 01 Jan 1998 09:00:00 -0400"@@ -40,9 +53,9 @@ > until m = takeWhile (<= m)  > tests :: [Test]-> tests = +> tests = >      [ testGroup "RFC5445 Examples" $ zipWith (testCase . show) [1::Int ..]->        [ assertEqual ("Test Daily from "++ show date1 ++". 10 Occurrences") +>        [ assertEqual ("Test Daily from "++ show date1 ++". 10 Occurrences") >            (take 10 $ starting date1 $ recur daily) >            (take 10 $ starting date1 $ recur monthly >==> enum (Days [2 .. 11])) >        , assertEqual ("Test Daily from "++ show date1 ++". Until "++ show date2)@@ -57,10 +70,18 @@ >            (until date4 $ starting date3 $ recur yearly >==> enum (Months [January]) >==> enum (WeekDaysInMonth [Monday .. Sunday])) >            (until date4 $ starting date3 $ recur daily >==> filter (Months [January])) >        ]+>      , testGroup "Tests to ensure Github Issue-1 is fixed" $ zipWith (testCase . show) [1::Int ..]+>        [ getCurrentTime >>= \now ->+>          assertEqual ("Generate 3 dates on the 0 and 30 minute marks")+>            3 (length $ take 3 . starting now $ recur daily >==> enum (Minutes [0,30]))+>        , getCurrentTime >>= \now ->+>          assertEqual ("Generate a single date on the 0 minute mark")+>           1 (length $ take 1 . starting now $ recur daily >==> enum (Minutes [0]))+>        ] >      ]  This is the assertion function for testing the number of days between moments.-It will be used in a couple of tests, and requires at least two moments to +It will be used in a couple of tests, and requires at least two moments to operate correctly.  > dayDist :: [UTCTime] -> [Integer]
time-recurrence.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version:             0.9.2+Version:             0.9.3  -- A short (one-line) description of the package. Synopsis:            Generate recurring dates.@@ -37,7 +37,7 @@ Maintainer:          hellertime@gmail.com  -- A copyright notice.--- Copyright:           +-- Copyright:  Category:            System @@ -48,7 +48,7 @@  -- Extra files to be distributed with the package, such as examples or -- a README.-Extra-source-files:  +Extra-source-files:   README, AUTHORS, tests/Tests.lhs  source-repository head@@ -81,19 +81,19 @@      Data.Time.Moment.StartOfWeek,      Data.Time.Moment.Private,      Data.Time.Moment.UTC-  +   -- Packages needed in order to build this package.   Build-depends:       base >= 4 && < 5,-                       time >= 1.4 && < 1.5,+                       time >= 1.4 && < 1.6,                        data-ordlist >= 0.4.5,-                       mtl >= 2.0 && < 2.2-  +                       mtl >= 2.0 && < 2.3+   Default-Language:    Haskell98   -- Modules not exported by this package.-  -- Other-modules:       -  +  -- Other-modules:+   -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.-  -- Build-tools:         +  -- Build-tools:  Test-Suite test-time-recurrence   type:                 exitcode-stdio-1.0@@ -101,12 +101,12 @@   main-is:              Tests.lhs   ghc-options:          -Wall -fno-warn-name-shadowing -fno-warn-orphans   build-depends:        base >= 4 && < 5,-                        time >= 1.4 && < 1.5,+                        time >= 1.4 && < 1.6,                         data-ordlist >= 0.4.5,-                        mtl >= 2.0 && < 2.2,+                        mtl >= 2.0 && < 2.3,                         test-framework >= 0.8,                         test-framework-hunit >= 0.3.0,-                        HUnit >= 1.2 && < 1.3,+                        HUnit >= 1.2 && < 1.4,                         old-locale >= 1.0 && < 1.1   other-modules:     Data.Time.Recurrence