summary refs log tree commit diff
path: root/tests/profiles.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-08-30 21:52:32 +0200
committerLudovic Courtès <ludo@gnu.org>2014-08-30 21:52:32 +0200
commit79601521fceb6b2f76d87cf3df45a76e43b1ffcf (patch)
tree5b4770c5a8df21c075b0f18c359be894c380070b /tests/profiles.scm
parentb9a31d90e907db0a593ec80aacc35a0523a009f6 (diff)
downloadguix-79601521fceb6b2f76d87cf3df45a76e43b1ffcf.tar.gz
profiles: Compute transaction effects in a functional way.
* guix/profiles.scm (manifest-transaction-effects): New procedure.
  (manifest-show-transaction): Use it instead of locally computing it.
* tests/profiles.scm (glibc): New variable.
  ("manifest-transaction-effects"): New test.
Diffstat (limited to 'tests/profiles.scm')
-rw-r--r--tests/profiles.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 047c5ba49b..d88def32fd 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -26,6 +26,7 @@
   #:use-module (guix derivations)
   #:use-module (gnu packages bootstrap)
   #:use-module (ice-9 match)
+  #:use-module (srfi srfi-11)
   #:use-module (srfi srfi-64))
 
 ;; Test the (guix profiles) module.
@@ -53,6 +54,13 @@
   (manifest-entry (inherit guile-2.0.9)
     (output "debug")))
 
+(define glibc
+  (manifest-entry
+    (name "glibc")
+    (version "2.19")
+    (item "/gnu/store/...")
+    (output "out")))
+
 
 (test-begin "profiles")
 
@@ -136,6 +144,17 @@
          (equal? m1 m2)
          (null? (manifest-entries m3)))))
 
+(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")))))))
+    (let-values (((remove install upgrade)
+                  (manifest-transaction-effects m0 t)))
+      (and (null? remove)
+           (equal? (list glibc) install)
+           (equal? (list guile-2.0.9) upgrade)))))
+
 (test-assert "profile-derivation"
   (run-with-store %store
     (mlet* %store-monad