From 8ab0465d92159cee9649210c9088641dd3ab4d6f Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Tue, 27 Mar 2018 00:23:37 +0200 Subject: job-specifier: Check 'job' * tests/job-specifier.scm ("job: procedure timeproc") ("job: list timeproc", "job: string timeproc", "job: list action") ("job: invalid string timeproc", "job: invalid timeproc") ("job: procedure action", "job: string action") ("job: user name"): New tests. --- tests/job-specifier.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'tests') diff --git a/tests/job-specifier.scm b/tests/job-specifier.scm index 636c1a1..baf96af 100644 --- a/tests/job-specifier.scm +++ b/tests/job-specifier.scm @@ -132,4 +132,41 @@ #t (set-configuration-user 'wrong)) +;;; +;;; Check the 'job' procedure +;;; + +(test-assert "job: procedure timeproc" + (job 1+ "dummy action")) + +(test-assert "job: list timeproc" + (job '(next-hour '(0)) "dummy action")) + +(test-assert "job: string timeproc" + (job "30 4 1,15 * 5" "dummy action")) + +(test-error "job: invalid string timeproc" + 'mcron-error + (job "30 4 1,15 * WRONG" "dummy action")) + +(test-error "job: invalid timeproc" + 'mcron-error + (job 42 "dummy action")) + +(test-assert "job: procedure action" + (job 1+ (λ () (display "hello\n")))) + +(test-assert "job: list action" + (job 1+ '(display "hello\n"))) + +(test-assert "job: string action" + (job 1+ "echo hello")) + +(test-error "job: string action" + 'mcron-error + (job 1+ 42)) + +(test-assert "job: user name" + (job 1+ "dummy action" #:user (getuid))) + (test-end) -- cgit v1.2.3