Commit | Line | Data |
---|---|---|
2ca299ca LC |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2018 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-inferior) | |
20 | #:use-module (guix inferior) | |
21 | #:use-module (guix packages) | |
22 | #:use-module (gnu packages) | |
23 | #:use-module (srfi srfi-1) | |
24 | #:use-module (srfi srfi-64)) | |
25 | ||
26 | (define %top-srcdir | |
27 | (dirname (search-path %load-path "guix.scm"))) | |
28 | ||
29 | (define %top-builddir | |
30 | (dirname (search-path %load-compiled-path "guix.go"))) | |
31 | ||
32 | \f | |
33 | (test-begin "inferior") | |
34 | ||
35 | (test-equal "open-inferior" | |
36 | '(42 #t) | |
37 | (let ((inferior (open-inferior %top-builddir | |
38 | #:command "scripts/guix"))) | |
39 | (and (inferior? inferior) | |
40 | (let ((a (inferior-eval '(apply * '(6 7)) inferior)) | |
41 | (b (inferior-eval '(@ (gnu packages base) coreutils) | |
42 | inferior))) | |
43 | (close-inferior inferior) | |
44 | (list a (inferior-object? b)))))) | |
45 | ||
46 | (test-equal "inferior-packages" | |
47 | (take (sort (fold-packages (lambda (package lst) | |
7e1d2290 | 48 | (cons (list (package-name package) |
2ca299ca | 49 | (package-version package) |
7e1d2290 LC |
50 | (package-home-page package) |
51 | (package-location package)) | |
52 | lst)) | |
2ca299ca LC |
53 | '()) |
54 | (lambda (x y) | |
55 | (string<? (car x) (car y)))) | |
56 | 10) | |
57 | (let* ((inferior (open-inferior %top-builddir | |
58 | #:command "scripts/guix")) | |
59 | (packages (inferior-packages inferior))) | |
60 | (and (every string? (map inferior-package-synopsis packages)) | |
7e1d2290 LC |
61 | (let () |
62 | (define result | |
63 | (take (sort (map (lambda (package) | |
64 | (list (inferior-package-name package) | |
65 | (inferior-package-version package) | |
66 | (inferior-package-home-page package) | |
67 | (inferior-package-location package))) | |
68 | packages) | |
69 | (lambda (x y) | |
70 | (string<? (car x) (car y)))) | |
71 | 10)) | |
2ca299ca | 72 | (close-inferior inferior) |
7e1d2290 | 73 | result)))) |
2ca299ca LC |
74 | |
75 | (test-end "inferior") |