SummaryRefsLogTreeCommitDiffStats
path: root/tests
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2018-03-27 00:23:37 +0200
committerMathieu Lirzin <mthl@gnu.org>2018-03-27 03:17:36 +0200
commit8ab0465d92159cee9649210c9088641dd3ab4d6f (patch)
tree306a764ec0ec8745a3340d781630c73c47252910 /tests
parent15fa52f7ec85b3c2cb9f00ec8609dfe63a9ea9cd (diff)
downloadmcron-8ab0465d92159cee9649210c9088641dd3ab4d6f.tar.gz
mcron-8ab0465d92159cee9649210c9088641dd3ab4d6f.tar.bz2
mcron-8ab0465d92159cee9649210c9088641dd3ab4d6f.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/job-specifier.scm37
1 files changed, 37 insertions, 0 deletions
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)