Added two more test dates; pleased v vet

main
Jef Roosens 2022-04-12 21:23:38 +02:00
parent 1116fee3fc
commit 5ce431aa4a
Signed by untrusted user: Jef Roosens
GPG Key ID: 2619CD13516CF9C4
3 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@ pub:
base_image string = 'archlinux:base-devel' base_image string = 'archlinux:base-devel'
} }
// cmd returns the cli module that handles the cron daemon.
pub fn cmd() cli.Command { pub fn cmd() cli.Command {
return cli.Command{ return cli.Command{
name: 'cron' name: 'cron'

View File

@ -12,6 +12,7 @@ fn (r1 ScheduledBuild) < (r2 ScheduledBuild) bool {
return r1.timestamp < r2.timestamp return r1.timestamp < r2.timestamp
} }
// cron starts a cron daemon & starts periodically scheduling builds.
pub fn cron(conf Config) ? { pub fn cron(conf Config) ? {
ce := parse_expression('0 3') ? ce := parse_expression('0 3') ?
t := time.parse('2002-01-01 00:00:00') ? t := time.parse('2002-01-01 00:00:00') ?

View File

@ -25,4 +25,10 @@ fn test_next_simple() ? {
util_test_time('0 3', '2002-01-01 04:00:00', '2002-01-02 03:00:00') ? util_test_time('0 3', '2002-01-01 04:00:00', '2002-01-02 03:00:00') ?
util_test_time('0 3/4', '2002-01-01 04:00:00', '2002-01-01 07:00:00') ? util_test_time('0 3/4', '2002-01-01 04:00:00', '2002-01-01 07:00:00') ?
// Overlap to next month
util_test_time('0 3', '2002-11-31 04:00:00', '2002-12-01 03:00:00') ?
// Overlap to next year
util_test_time('0 3', '2002-12-31 04:00:00', '2003-01-01 03:00:00') ?
} }