utils: Fix default-keyword-arguments.
* guix/utils.scm (default-keyword-arguments): Properly test for present keywords. * tests/utils.scm (default-keyword-arguments): New test.
This commit is contained in:
parent
fb29e737d4
commit
347df60158
@ -369,7 +369,7 @@ keywords not already present in ARGS."
|
|||||||
(match defaults
|
(match defaults
|
||||||
((kw value rest ...)
|
((kw value rest ...)
|
||||||
(loop rest
|
(loop rest
|
||||||
(if (assoc-ref kw args)
|
(if (memq kw args)
|
||||||
args
|
args
|
||||||
(cons* kw value args))))
|
(cons* kw value args))))
|
||||||
(()
|
(()
|
||||||
|
@ -111,6 +111,18 @@
|
|||||||
(ensure-keyword-arguments '(#:foo 2) '(#:bar 3))
|
(ensure-keyword-arguments '(#:foo 2) '(#:bar 3))
|
||||||
(ensure-keyword-arguments '(#:foo 2) '(#:bar 3 #:foo 42))))
|
(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"
|
(test-assert "filtered-port, file"
|
||||||
(let* ((file (search-path %load-path "guix.scm"))
|
(let* ((file (search-path %load-path "guix.scm"))
|
||||||
(input (open-file file "r0b")))
|
(input (open-file file "r0b")))
|
||||||
|
Loading…
Reference in New Issue
Block a user