1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
27 (dirname (search-path %load-path "guix.scm")))
30 (dirname (search-path %load-compiled-path "guix.go")))
33 (test-begin "inferior")
35 (test-equal "open-inferior"
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)
43 (close-inferior inferior)
44 (list a (inferior-object? b))))))
46 (test-equal "inferior-packages"
47 (take (sort (fold-packages (lambda (package lst)
48 (alist-cons (package-name package)
49 (package-version package)
53 (string<? (car x) (car y))))
55 (let* ((inferior (open-inferior %top-builddir
56 #:command "scripts/guix"))
57 (packages (inferior-packages inferior)))
58 (and (every string? (map inferior-package-synopsis packages))
60 (close-inferior inferior)
61 (take (sort (map (lambda (package)
62 (cons (inferior-package-name package)
63 (inferior-package-version package)))
66 (string<? (car x) (car y))))