1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2019 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/>.
20 (define-module (test-scripts)
21 #:use-module (guix scripts)
22 #:use-module (guix tests)
23 #:use-module ((guix scripts build)
24 #:select (%standard-build-options))
25 #:use-module (srfi srfi-64))
27 ;; Test the (guix scripts) module.
30 (test-begin "scripts")
32 (test-equal "parse-command-line"
33 '((argument . "bar") (argument . "foo")
34 (cores . 10) ;takes precedence
35 (substitutes? . #f) (keep-failed? . #t)
36 (max-jobs . 77) (cores . 42))
38 (with-environment-variable "GUIX_BUILD_OPTIONS" "-c 42 -M 77"
39 (parse-command-line '("--keep-failed" "--no-substitutes"
40 "--cores=10" "foo" "bar")
41 %standard-build-options
44 (test-equal "parse-command-line and --no options"
46 (substitutes? . #f)) ;takes precedence
48 (with-environment-variable "GUIX_BUILD_OPTIONS" "--no-substitutes"
49 (parse-command-line '("foo")
50 %standard-build-options
51 (list '((substitutes? . #t))))))
56 ;;; eval: (put 'with-environment-variable 'scheme-indent-function 2)