summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/utils.scm2
-rw-r--r--tests/utils.scm12
2 files changed, 13 insertions, 1 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index c68094cf49..ded31142aa 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -369,7 +369,7 @@ keywords not already present in ARGS."
(match defaults
((kw value rest ...)
(loop rest
- (if (assoc-ref kw args)
+ (if (memq kw args)
args
(cons* kw value args))))
(()
diff --git a/tests/utils.scm b/tests/utils.scm
index 6590ed91cf..960928c842 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -111,6 +111,18 @@
(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-assert "filtered-port, file"
(let* ((file (search-path %load-path "guix.scm"))
(input (open-file file "r0b")))