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
					
				
					 2 changed files with 13 additions and 1 deletions
				
			
		|  | @ -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)))) | ||||
|       (() | ||||
|  |  | |||
|  | @ -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"))) | ||||
|  |  | |||
		Reference in a new issue