diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-07-10 14:18:36 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-07-13 17:28:39 +0200 |
| commit | 2ca299caf64489f4e1e665ec1158fb0309b0b565 (patch) | |
| tree | 29a657a53161916cc64b6d0365c712501d666919 /tests | |
| parent | bc6e291ef0b3c71c07e50d88d7764e5dd334e8b1 (diff) | |
Add (guix inferior) and (guix scripts repl).
* guix/inferior.scm, guix/scripts/repl.scm, tests/inferior.scm: New
files.
* Makefile.am (MODULES): Add 'guix/scripts/repl.scm' and
'guix/inferior.scm'.
(SCM_TESTS): Add 'tests/inferior.scm'.
* doc/guix.texi (Invoking guix repl): New node.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/inferior.scm | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/inferior.scm b/tests/inferior.scm new file mode 100644 index 00000000000..5e0f8ae66e0 --- /dev/null +++ b/tests/inferior.scm | |||
| @@ -0,0 +1,69 @@ | |||
| 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 | |||
| 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) | ||
| 48 | (alist-cons (package-name package) | ||
| 49 | (package-version package) | ||
| 50 | lst)) | ||
| 51 | '()) | ||
| 52 | (lambda (x y) | ||
| 53 | (string<? (car x) (car y)))) | ||
| 54 | 10) | ||
| 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)) | ||
| 59 | (begin | ||
| 60 | (close-inferior inferior) | ||
| 61 | (take (sort (map (lambda (package) | ||
| 62 | (cons (inferior-package-name package) | ||
| 63 | (inferior-package-version package))) | ||
| 64 | packages) | ||
| 65 | (lambda (x y) | ||
| 66 | (string<? (car x) (car y)))) | ||
| 67 | 10))))) | ||
| 68 | |||
| 69 | (test-end "inferior") | ||
