Commit | Line | Data |
---|---|---|
a2078770 LC |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org> | |
3 | ;;; | |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
7 | ;;; under the terms of the GNU General Public License as published by | |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | ;;; your option) any later version. | |
10 | ;;; | |
11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;;; GNU General Public License for more details. | |
15 | ;;; | |
16 | ;;; You should have received a copy of the GNU General Public License | |
17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | (define-module (test-profiles) | |
20 | #:use-module (guix profiles) | |
21 | #:use-module (ice-9 match) | |
22 | #:use-module (srfi srfi-64)) | |
23 | ||
24 | ;; Test the (guix profile) module. | |
25 | ||
26 | ||
27 | ;; Example manifest entries. | |
28 | ||
29 | (define guile-2.0.9 | |
30 | (manifest-entry | |
31 | (name "guile") | |
32 | (version "2.0.9") | |
33 | (path "/gnu/store/...") | |
34 | (output "out"))) | |
35 | ||
36 | (define guile-2.0.9:debug | |
37 | (manifest-entry (inherit guile-2.0.9) | |
38 | (output "debug"))) | |
39 | ||
40 | \f | |
41 | (test-begin "profiles") | |
42 | ||
43 | (test-assert "manifest-installed?" | |
44 | (let ((m (manifest (list guile-2.0.9 guile-2.0.9:debug)))) | |
45 | (and (manifest-installed? m (manifest-pattern (name "guile"))) | |
46 | (manifest-installed? m (manifest-pattern | |
47 | (name "guile") (output "debug"))) | |
48 | (manifest-installed? m (manifest-pattern | |
49 | (name "guile") (output "out") | |
50 | (version "2.0.9"))) | |
51 | (not (manifest-installed? | |
52 | m (manifest-pattern (name "guile") (version "1.8.8")))) | |
53 | (not (manifest-installed? | |
54 | m (manifest-pattern (name "guile") (output "foobar"))))))) | |
55 | ||
56 | (test-assert "manifest-matching-entries" | |
57 | (let* ((e (list guile-2.0.9 guile-2.0.9:debug)) | |
58 | (m (manifest e))) | |
59 | (and (null? (manifest-matching-entries m | |
60 | (list (manifest-pattern | |
61 | (name "python"))))) | |
62 | (equal? e | |
63 | (manifest-matching-entries m | |
64 | (list (manifest-pattern | |
65 | (name "guile") | |
66 | (output #f))))) | |
67 | (equal? (list guile-2.0.9) | |
68 | (manifest-matching-entries m | |
69 | (list (manifest-pattern | |
70 | (name "guile") | |
71 | (version "2.0.9")))))))) | |
72 | ||
73 | (test-assert "manifest-remove" | |
74 | (let* ((m0 (manifest (list guile-2.0.9 guile-2.0.9:debug))) | |
75 | (m1 (manifest-remove m0 | |
76 | (list (manifest-pattern (name "guile"))))) | |
77 | (m2 (manifest-remove m1 | |
78 | (list (manifest-pattern (name "guile"))))) ; same | |
79 | (m3 (manifest-remove m2 | |
80 | (list (manifest-pattern | |
81 | (name "guile") (output "debug"))))) | |
82 | (m4 (manifest-remove m3 | |
83 | (list (manifest-pattern (name "guile")))))) | |
84 | (match (manifest-entries m2) | |
85 | ((($ <manifest-entry> "guile" "2.0.9" "debug")) | |
86 | (and (equal? m1 m2) | |
87 | (null? (manifest-entries m3)) | |
88 | (null? (manifest-entries m4))))))) | |
89 | ||
90 | (test-end "profiles") | |
91 | ||
92 | \f | |
93 | (exit (= (test-runner-fail-count (test-runner-current)) 0)) | |
94 | ||
95 | ;;; Local Variables: | |
96 | ;;; eval: (put 'dummy-package 'scheme-indent-function 1) | |
97 | ;;; End: |