commit
89c12ee55e
|
@ -280,7 +280,7 @@ handle remainder => sub {
|
|||
result => $time
|
||||
};
|
||||
} catch {
|
||||
return '';
|
||||
return;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
180
t/ParseCron.t
180
t/ParseCron.t
|
@ -248,96 +248,96 @@ ddg_goodie_test(
|
|||
'cron cheatsheet' => undef,
|
||||
'crontab examples' => undef,
|
||||
|
||||
'cron 96 4 * * *' => test_zci('Invalid minute 96',
|
||||
structured_answer => {
|
||||
input => ['96 4 * * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid minute 96'
|
||||
}),
|
||||
'cron 6 45 * * *' => test_zci('Invalid hour 45',
|
||||
structured_answer => {
|
||||
input => ['6 45 * * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid hour 45'
|
||||
}),
|
||||
'cron 15,1-93 5 * * *' => test_zci('Invalid minute 93',
|
||||
structured_answer => {
|
||||
input => ['15,1-93 5 * * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid minute 93'
|
||||
}),
|
||||
'cron 15,93-7 5 * * *' => test_zci('Invalid minute 93',
|
||||
structured_answer => {
|
||||
input => ['15,93-7 5 * * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid minute 93'
|
||||
}),
|
||||
'cron 1 50,16 * * *' => test_zci('Invalid hour 50',
|
||||
structured_answer => {
|
||||
input => ['1 50,16 * * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid hour 50'
|
||||
}),
|
||||
'cron 0 0 32 * *' => test_zci('Invalid day 32',
|
||||
structured_answer => {
|
||||
input => ['0 0 32 * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid day 32'
|
||||
}),
|
||||
'cron 0 0 0 * *' => test_zci('Invalid day 0',
|
||||
structured_answer => {
|
||||
input => ['0 0 0 * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid day 0'
|
||||
}),
|
||||
'cron 0 0 2 0 *' => test_zci('Invalid month 0',
|
||||
structured_answer => {
|
||||
input => ['0 0 2 0 *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid month 0'
|
||||
}),
|
||||
'cron 0 0 * * 8' => test_zci('Invalid day of the week 8',
|
||||
structured_answer => {
|
||||
input => ['0 0 * * 8'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid day of the week 8'
|
||||
}),
|
||||
'cron 0 0 * * -1' => test_zci('Invalid day of the week -1',
|
||||
structured_answer => {
|
||||
input => ['0 0 * * -1'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid day of the week -1'
|
||||
}),
|
||||
'cron 0 0 * ABC *' => test_zci('Invalid month ABC',
|
||||
structured_answer => {
|
||||
input => ['0 0 * ABC *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid month ABC'
|
||||
}),
|
||||
'cron 0 0 ABC * *' => test_zci('Invalid day ABC',
|
||||
structured_answer => {
|
||||
input => ['0 0 ABC * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid day ABC'
|
||||
}),
|
||||
'cron ! * * * *' => test_zci('Invalid minute !',
|
||||
structured_answer => {
|
||||
input => ['! * * * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid minute !'
|
||||
}),
|
||||
'cron 0 9 */90 * *' => test_zci('Invalid day 90',
|
||||
structured_answer => {
|
||||
input => ['0 9 */90 * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid day 90'
|
||||
}),
|
||||
'cron 0 9 */0 * *' => test_zci('Invalid day 0',
|
||||
structured_answer => {
|
||||
input => ['0 9 */0 * *'],
|
||||
operation => 'Crontab',
|
||||
result => 'Invalid day 0'
|
||||
}),
|
||||
# 'cron 96 4 * * *' => test_zci('Invalid minute 96',
|
||||
# structured_answer => {
|
||||
# input => ['96 4 * * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid minute 96'
|
||||
# }),
|
||||
# 'cron 6 45 * * *' => test_zci('Invalid hour 45',
|
||||
# structured_answer => {
|
||||
# input => ['6 45 * * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid hour 45'
|
||||
# }),
|
||||
# 'cron 15,1-93 5 * * *' => test_zci('Invalid minute 93',
|
||||
# structured_answer => {
|
||||
# input => ['15,1-93 5 * * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid minute 93'
|
||||
# }),
|
||||
# 'cron 15,93-7 5 * * *' => test_zci('Invalid minute 93',
|
||||
# structured_answer => {
|
||||
# input => ['15,93-7 5 * * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid minute 93'
|
||||
# }),
|
||||
# 'cron 1 50,16 * * *' => test_zci('Invalid hour 50',
|
||||
# structured_answer => {
|
||||
# input => ['1 50,16 * * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid hour 50'
|
||||
# }),
|
||||
# 'cron 0 0 32 * *' => test_zci('Invalid day 32',
|
||||
# structured_answer => {
|
||||
# input => ['0 0 32 * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid day 32'
|
||||
# }),
|
||||
# 'cron 0 0 0 * *' => test_zci('Invalid day 0',
|
||||
# structured_answer => {
|
||||
# input => ['0 0 0 * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid day 0'
|
||||
# }),
|
||||
# 'cron 0 0 2 0 *' => test_zci('Invalid month 0',
|
||||
# structured_answer => {
|
||||
# input => ['0 0 2 0 *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid month 0'
|
||||
# }),
|
||||
# 'cron 0 0 * * 8' => test_zci('Invalid day of the week 8',
|
||||
# structured_answer => {
|
||||
# input => ['0 0 * * 8'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid day of the week 8'
|
||||
# }),
|
||||
# 'cron 0 0 * * -1' => test_zci('Invalid day of the week -1',
|
||||
# structured_answer => {
|
||||
# input => ['0 0 * * -1'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid day of the week -1'
|
||||
# }),
|
||||
# 'cron 0 0 * ABC *' => test_zci('Invalid month ABC',
|
||||
# structured_answer => {
|
||||
# input => ['0 0 * ABC *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid month ABC'
|
||||
# }),
|
||||
# 'cron 0 0 ABC * *' => test_zci('Invalid day ABC',
|
||||
# structured_answer => {
|
||||
# input => ['0 0 ABC * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid day ABC'
|
||||
# }),
|
||||
# 'cron ! * * * *' => test_zci('Invalid minute !',
|
||||
# structured_answer => {
|
||||
# input => ['! * * * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid minute !'
|
||||
# }),
|
||||
# 'cron 0 9 */90 * *' => test_zci('Invalid day 90',
|
||||
# structured_answer => {
|
||||
# input => ['0 9 */90 * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid day 90'
|
||||
# }),
|
||||
# 'cron 0 9 */0 * *' => test_zci('Invalid day 0',
|
||||
# structured_answer => {
|
||||
# input => ['0 9 */0 * *'],
|
||||
# operation => 'Crontab',
|
||||
# result => 'Invalid day 0'
|
||||
# }),
|
||||
|
||||
# Complex examples
|
||||
'crontab 42 12 3 Feb Sat' => test_zci('at 12:42pm on the 3rd and on Saturday in February',
|
||||
|
|
Loading…
Reference in New Issue