aboutsummaryrefslogtreecommitdiff
path: root/tests/profiles.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2019-02-07 14:54:43 +0100
committerLudovic Courtès <ludo@gnu.org>2019-02-07 15:46:45 +0100
commit487cbb0164c715e722b622fa800fa0b217fa132c (patch)
treea5ac1d86abb0cb575496bb2293c5e325d7d13b2f /tests/profiles.scm
parent89ea6252b6849131ba35d141006e1bbf3a49594f (diff)
downloadguix-487cbb0164c715e722b622fa800fa0b217fa132c.tar
guix-487cbb0164c715e722b622fa800fa0b217fa132c.tar.gz
profiles: Raise an error for unmatched patterns.
Previously, "guix package -r something-not-installed" would silently complete. Now an error is raised. * guix/profiles.scm (&unmatched-pattern-error): New condition type. (manifest-matching-entries): Rewrite to raise an error when one of PATTERNS is not matched. * guix/ui.scm (call-with-error-handling): Handle 'unmatched-pattern-error?'. * tests/guix-package.sh: Add test. * tests/profiles.scm ("manifest-matching-entries"): Don't try to remove unmatched pattern. ("manifest-matching-entries, no match"): New test. ("manifest-transaction-effects"): Remove 'remove' field.
Diffstat (limited to 'tests/profiles.scm')
-rw-r--r--tests/profiles.scm17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 9a05030aff..eef93e24cf 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -93,10 +93,7 @@
(test-assert "manifest-matching-entries"
(let* ((e (list guile-2.0.9 guile-2.0.9:debug))
(m (manifest e)))
- (and (null? (manifest-matching-entries m
- (list (manifest-pattern
- (name "python")))))
- (equal? e
+ (and (equal? e
(manifest-matching-entries m
(list (manifest-pattern
(name "guile")
@@ -107,6 +104,15 @@
(name "guile")
(version "2.0.9"))))))))
+(test-assert "manifest-matching-entries, no match"
+ (let ((m (manifest (list guile-2.0.9)))
+ (p (manifest-pattern (name "python"))))
+ (guard (c ((unmatched-pattern-error? c)
+ (and (eq? p (unmatched-pattern-error-pattern c))
+ (eq? m (unmatched-pattern-error-manifest c)))))
+ (manifest-matching-entries m (list p))
+ #f)))
+
(test-assert "manifest-remove"
(let* ((m0 (manifest (list guile-2.0.9 guile-2.0.9:debug)))
(m1 (manifest-remove m0
@@ -165,8 +171,7 @@
(test-assert "manifest-transaction-effects"
(let* ((m0 (manifest (list guile-1.8.8)))
(t (manifest-transaction
- (install (list guile-2.0.9 glibc))
- (remove (list (manifest-pattern (name "coreutils")))))))
+ (install (list guile-2.0.9 glibc)))))
(let-values (((remove install upgrade downgrade)
(manifest-transaction-effects m0 t)))
(and (null? remove) (null? downgrade)