Commit | Line | Data |
---|---|---|
88981dd3 | 1 | ;;; GNU Guix --- Functional package management for GNU |
22f95e02 | 2 | ;;; Copyright © 2015, 2019 Ludovic Courtès <ludo@gnu.org> |
88981dd3 AK |
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) | |
7b7e4e89 | 22 | #:use-module (guix tests) |
88981dd3 AK |
23 | #:use-module ((guix scripts build) |
24 | #:select (%standard-build-options)) | |
25 | #:use-module (srfi srfi-64)) | |
26 | ||
27 | ;; Test the (guix scripts) module. | |
28 | ||
88981dd3 AK |
29 | \f |
30 | (test-begin "scripts") | |
31 | ||
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)) | |
37 | ||
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 | |
42 | (list '())))) | |
43 | ||
44 | (test-equal "parse-command-line and --no options" | |
45 | '((argument . "foo") | |
46 | (substitutes? . #f)) ;takes precedence | |
47 | ||
48 | (with-environment-variable "GUIX_BUILD_OPTIONS" "--no-substitutes" | |
49 | (parse-command-line '("foo") | |
50 | %standard-build-options | |
51 | (list '((substitutes? . #t)))))) | |
52 | ||
53 | (test-end "scripts") | |
54 | ||
88981dd3 AK |
55 | ;;; Local Variables: |
56 | ;;; eval: (put 'with-environment-variable 'scheme-indent-function 2) | |
57 | ;;; End: |