summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2016-10-12 09:28:14 -0400
committerMark H Weaver <mhw@netris.org>2016-10-12 09:28:14 -0400
commitabcf4858cda9ded59671681ab9820b5358d8bb16 (patch)
treefd1b0a53affad3ad0eb9b3867a2c127228530973 /tests
parent82adf4952ac1c03af3b41851ef4bbe1d2d6935a0 (diff)
parentbfb48f4f33583f58392a05f1d6cbf559156293ed (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.scm32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 6590ed91cf..bcfaa14faa 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -111,6 +111,38 @@
(ensure-keyword-arguments '(#:foo 2) '(#:bar 3))
(ensure-keyword-arguments '(#:foo 2) '(#:bar 3 #:foo 42))))
+(test-equal "default-keyword-arguments"
+ '((#:foo 2)
+ (#:foo 2)
+ (#:foo 2 #:bar 3)
+ (#:foo 2 #:bar 3)
+ (#:foo 2 #:bar 3))
+ (list (default-keyword-arguments '() '(#:foo 2))
+ (default-keyword-arguments '(#:foo 2) '(#:foo 4))
+ (default-keyword-arguments '() '(#:bar 3 #:foo 2))
+ (default-keyword-arguments '(#:bar 3) '(#:foo 2))
+ (default-keyword-arguments '(#:foo 2 #:bar 3) '(#:bar 6))))
+
+(test-equal "substitute-keyword-arguments"
+ '((#:foo 3)
+ (#:foo 3)
+ (#:foo 3 #:bar (1 2))
+ (#:bar (1 2) #:foo 3)
+ (#:foo 3))
+ (list (substitute-keyword-arguments '(#:foo 2)
+ ((#:foo f) (1+ f)))
+ (substitute-keyword-arguments '()
+ ((#:foo f 2) (1+ f)))
+ (substitute-keyword-arguments '(#:foo 2 #:bar (2))
+ ((#:foo f) (1+ f))
+ ((#:bar b) (cons 1 b)))
+ (substitute-keyword-arguments '(#:foo 2)
+ ((#:foo _) 3)
+ ((#:bar b '(2)) (cons 1 b)))
+ (substitute-keyword-arguments '(#:foo 2)
+ ((#:foo f 1) (1+ f))
+ ((#:bar b) (cons 42 b)))))
+
(test-assert "filtered-port, file"
(let* ((file (search-path %load-path "guix.scm"))
(input (open-file file "r0b")))