From 066eeae1a197b1926c7ffc42919d684686f56fdb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 23 Jun 2019 18:28:45 +0200 Subject: packages: 'specification->package+output' distinguishes "no output specified". Until now the caller couldn't tell the different between a spec like "foo:out" and one like "foo". This change allows users to distinguish between these two cases. * gnu/packages.scm (specification->package+output): Disable output membership test when OUTPUT = #f and SUB-DRV = #f. * tests/packages.scm ("specification->package+output") ("specification->package+output invalid output") ("specification->package+output no default output") ("specification->package+output invalid output, no default"): New tests. --- tests/packages.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/packages.scm') diff --git a/tests/packages.scm b/tests/packages.scm index 613b2f1221..836d446657 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1227,6 +1227,38 @@ (lambda (key . args) key))) +(test-equal "specification->package+output" + `((,coreutils "out") (,coreutils "debug")) + (list (call-with-values (lambda () + (specification->package+output "coreutils")) + list) + (call-with-values (lambda () + (specification->package+output "coreutils:debug")) + list))) + +(test-equal "specification->package+output invalid output" + 'error + (catch 'quit + (lambda () + (specification->package+output "coreutils:does-not-exist")) + (lambda _ + 'error))) + +(test-equal "specification->package+output no default output" + `(,coreutils #f) + (call-with-values + (lambda () + (specification->package+output "coreutils" #f)) + list)) + +(test-equal "specification->package+output invalid output, no default" + 'error + (catch 'quit + (lambda () + (specification->package+output "coreutils:does-not-exist" #f)) + (lambda _ + 'error))) + (test-equal "find-package-locations" (map (lambda (package) (cons (package-version package) -- cgit v1.2.3