From 9a51fb39f4b37cdbd21abfc5cecd1cedc8eb9904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20Ma=CC=88nnchen?= Date: Tue, 11 Jul 2017 09:40:59 +0000 Subject: [PATCH] Fix Special Expressions secondly --- lib/crontab/cron_expression/parser.ex | 2 +- test/crontab/cron_expression/parser_test.exs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/crontab/cron_expression/parser.ex b/lib/crontab/cron_expression/parser.ex index b88d92a..4109c85 100644 --- a/lib/crontab/cron_expression/parser.ex +++ b/lib/crontab/cron_expression/parser.ex @@ -17,7 +17,7 @@ defmodule Crontab.CronExpression.Parser do midnight: %CronExpression{minute: [0], hour: [0]}, hourly: %CronExpression{minute: [0]}, minutely: %CronExpression{}, - secondly: %CronExpression{}, + secondly: %CronExpression{extended: true}, } @intervals [ diff --git a/test/crontab/cron_expression/parser_test.exs b/test/crontab/cron_expression/parser_test.exs index ab23745..f7112fd 100644 --- a/test/crontab/cron_expression/parser_test.exs +++ b/test/crontab/cron_expression/parser_test.exs @@ -43,6 +43,14 @@ defmodule Crontab.CronExpression.ParserTest do assert parse("@hourly") == {:ok, %Crontab.CronExpression{minute: [0], hour: [:*], day: [:*], month: [:*], weekday: [:*], year: [:*]}} end + test "parse \"@minutely\" gives hourly" do + assert parse("@minutely") == {:ok, %Crontab.CronExpression{minute: [:*], hour: [:*], day: [:*], month: [:*], weekday: [:*], year: [:*]}} + end + + test "parse \"@secondly\" gives hourly" do + assert parse("@secondly") == {:ok, %Crontab.CronExpression{extended: true, second: [:*], minute: [:*], hour: [:*], day: [:*], month: [:*], weekday: [:*], year: [:*]}} + end + test "parse \"1 2 3 4 5 6 7\" gives error" do assert parse("1 2 3 4 5 6 7") == {:error, "The Cron Format String contains to many parts."} end