Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / tests / scripts.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2019 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
20 (define-module (test-scripts)
21 #:use-module (guix scripts)
22 #:use-module ((guix scripts build)
23 #:select (%standard-build-options))
24 #:use-module (srfi srfi-64))
25
26 ;; Test the (guix scripts) module.
27
28 \f
29 (test-begin "scripts")
30
31 (test-equal "parse-command-line"
32 '((argument . "bar") (argument . "foo")
33 (cores . 10) ;takes precedence
34 (substitutes? . #f) (keep-failed? . #t)
35 (max-jobs . 77) (cores . 42))
36
37 (with-environment-variable "GUIX_BUILD_OPTIONS" "-c 42 -M 77"
38 (parse-command-line '("--keep-failed" "--no-substitutes"
39 "--cores=10" "foo" "bar")
40 %standard-build-options
41 (list '()))))
42
43 (test-equal "parse-command-line and --no options"
44 '((argument . "foo")
45 (substitutes? . #f)) ;takes precedence
46
47 (with-environment-variable "GUIX_BUILD_OPTIONS" "--no-substitutes"
48 (parse-command-line '("foo")
49 %standard-build-options
50 (list '((substitutes? . #t))))))
51
52 (test-end "scripts")
53
54 ;;; Local Variables:
55 ;;; eval: (put 'with-environment-variable 'scheme-indent-function 2)
56 ;;; End: