cron 0.1.0 → 0.1.1
raw patch · 4 files changed
+23/−23 lines, 4 filesdep +crondep −HUnitdep −hspec-discoverdep ~hspecPVP ok
version bump matches the API change (PVP)
Dependencies added: cron
Dependencies removed: HUnit, hspec-discover
Dependency ranges changed: hspec
API changes (from Hackage documentation)
Files
- README.md +5/−0
- cron.cabal +4/−5
- test/System/Cron/ParserSpec.hs +5/−7
- test/System/CronSpec.hs +9/−11
README.md view
@@ -1,5 +1,6 @@ cron ====+[](http://travis-ci.org/MichaelXavier/cron) Cron data structure and Attoparsec parser for Haskell. The idea is to embed it in larger systems which want to roll their own scheduled tasks in a format that@@ -29,3 +30,7 @@ To generate docs: make docs++## Contributors++* [Simon Hengel](https://github.com/sol)
cron.cabal view
@@ -1,5 +1,5 @@ Name: cron-Version: 0.1.0+Version: 0.1.1 Description: Cron data structure and Attoparsec parser. The idea is to embed it in larger systems which want to roll their own scheduled tasks in a format that people@@ -44,11 +44,10 @@ test-suite spec Type: exitcode-stdio-1.0 Main-Is: Spec.hs- Hs-Source-Dirs: src, test+ Hs-Source-Dirs: test Build-Depends: base >= 4 && < 5,- hspec == 1.1.*,- hspec-discover == 0.*,- HUnit == 1.*,+ cron,+ hspec == 1.3.*, attoparsec == 0.10.*, text == 0.11.*, time >= 1.4
test/System/Cron/ParserSpec.hs view
@@ -4,9 +4,7 @@ import Data.Attoparsec.Text (parseOnly, Parser) import Data.Text (Text)-import Test.Hspec.Monadic-import Test.Hspec.HUnit ()-import Test.HUnit.Base ((~?=), Test)+import Test.Hspec import System.Cron import System.Cron.Parser@@ -149,16 +147,16 @@ => Parser a -> Text -> a- -> Test-assertParse parser txt expected = parsed ~?= Right expected+ -> Expectation+assertParse parser txt expected = parsed `shouldBe` Right expected where parsed = parseOnly parser txt --assertNoParse :: Parser a -> Text -> b assertNoParse :: (Eq a, Show a) => Parser a -> Text- -> Test-assertNoParse parser txt = isLeft parsed ~?= True+ -> Expectation+assertNoParse parser txt = isLeft parsed `shouldBe` True where isLeft (Left _) = True isLeft _ = False parsed = parseOnly parser txt
test/System/CronSpec.hs view
@@ -4,9 +4,7 @@ import Data.Time.Clock import Data.Time.Calendar import Data.Time.LocalTime-import Test.Hspec.Monadic-import Test.Hspec.HUnit ()-import Test.HUnit.Base ((~?=))+import Test.Hspec import System.Cron @@ -65,39 +63,39 @@ describeCronScheduleShow :: Spec describeCronScheduleShow = describe "CronSchedule show" $ do it "formats stars" $- show stars ~?=+ show stars `shouldBe` "CronSchedule * * * * *" it "formats specific numbers" $- show stars { dayOfWeek = DaysOfWeek (SpecificField 3)} ~?=+ show stars { dayOfWeek = DaysOfWeek (SpecificField 3)} `shouldBe` "CronSchedule * * * * 3" it "formats lists" $ show stars { minute = Minutes (ListField [SpecificField 1, SpecificField 2,- SpecificField 3])} ~?=+ SpecificField 3])} `shouldBe` "CronSchedule 1,2,3 * * * *" it "formats ranges" $- show stars { hour = Hours (RangeField 7 10)} ~?=+ show stars { hour = Hours (RangeField 7 10)} `shouldBe` "CronSchedule * 7-10 * * *" it "formats steps" $- show stars { dayOfMonth = DaysOfMonth (StepField (ListField [SpecificField 3, SpecificField 5]) 2)} ~?=+ show stars { dayOfMonth = DaysOfMonth (StepField (ListField [SpecificField 3, SpecificField 5]) 2)} `shouldBe` "CronSchedule * * 3,5/2 * *" describeCrontabShow :: Spec describeCrontabShow = describe "Crontab Show" $ do it "prints nothing for an empty crontab" $- show (Crontab []) ~?= ""+ show (Crontab []) `shouldBe` "" describeCrontabEntryShow :: Spec describeCrontabEntryShow = describe "CrontabEntry Show" $ do it "formats environment variable sets" $- show envSet ~?= "FOO=BAR"+ show envSet `shouldBe` "FOO=BAR" it "formats command entries" $- show entry ~?= "* * * * * do stuff"+ show entry `shouldBe` "* * * * * do stuff" envSet :: CrontabEntry