Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Fix crontab parsing #882

Closed
wants to merge 2 commits into from
Closed

Fix crontab parsing #882

wants to merge 2 commits into from

Conversation

p16i
Copy link
Contributor

@p16i p16i commented Dec 27, 2014

REF #124

@mintsoft
Copy link
Collaborator

@heytitle Hey, thanks for the PR. What issue is it exactly that's been fixed here?

@p16i
Copy link
Contributor Author

p16i commented Dec 28, 2014

@mintsoft Oh, I wrote the wrong REF. In fact, it should be #869

@@ -14,6 +14,8 @@ ddg_goodie_test(
)],
'crontab * */3 * * *' => test_zci(qr/^Cron will schedule the job at this frequency:\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),
'crontab 42 12 3 Feb Sat' => test_zci(qr/^Cron will schedule the job at this frequency:\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),
'crontab 42 12 3 feb sat' => test_zci(qr/^Cron will schedule the job at this frequency:\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),
'crontab 42 12 3 * sat' => test_zci(qr/^Cron will schedule the job at this frequency:\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s*\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you improve the tests here and add some other formats like:

crontab * 0/5 * * *
crontab 0 23 28-31 * *

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

On Dec 28, 2557 BE, at 7:34 PM, Rob Emery notifications@github.com wrote:

In t/ParseCron.t #882 (diff):

@@ -14,6 +14,8 @@ ddg_goodie_test(
)],
'crontab * /3 * * *' => test_zci(qr/^Cron will schedule the job at this frequency:\s\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),
'crontab 42 12 3 Feb Sat' => test_zci(qr/^Cron will schedule the job at this frequency:\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s*\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),

  • 'crontab 42 12 3 feb sat' => test_zci(qr/^Cron will schedule the job at this frequency:\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),
  • 'crontab 42 12 3 * sat' => test_zci(qr/^Cron will schedule the job at this frequency:\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}\s_\n\s_\d{1,2}:\d{1,2}:\d{1,2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/)
    Can you improve the tests here and add some other formats like:

crontab * 0/5 * * *
crontab 0 23 28-31 * *

Reply to this email directly or view it on GitHub https://github.com/duckduckgo/zeroclickinfo-goodies/pull/882/files#r22297725.

@mintsoft
Copy link
Collaborator

@heytitle if you can think of some more correct language, #124 could be resolved at the same time. The only phrase I can come up is "at a schedule like: "

@p16i
Copy link
Contributor Author

p16i commented Jan 9, 2015

@mintsoft since I have been away, The #885 seems to solve this bug already. I'll close it then.

@p16i p16i closed this Jan 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants