diff options
| author | Cyril Roelandt <tipecaml@gmail.com> | 2014-10-12 01:58:29 +0200 |
|---|---|---|
| committer | Cyril Roelandt <tipecaml@gmail.com> | 2014-10-16 00:50:27 +0200 |
| commit | dd7c013d4be0fea8db61c909f5ba6f877c143fd3 (patch) | |
| tree | 9af11d891f6eb2d6650139f0641849a20fd7624f /tests/guix-lint.sh | |
| parent | 51861587c670c390b3420f0da6a86111b386f750 (diff) | |
guix lint: add the --checkers option.
* guix/scripts/lint.scm: add the "--checkers" option.
* doc/guix.texi (Invoking guix lint): Document it.
* tests/guix-lint.sh: New file
* Makefile.am (SCM_TESTS): Add it.
Diffstat (limited to 'tests/guix-lint.sh')
| -rw-r--r-- | tests/guix-lint.sh | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/guix-lint.sh b/tests/guix-lint.sh new file mode 100644 index 00000000000..5623d53ce50 --- /dev/null +++ b/tests/guix-lint.sh | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | # GNU Guix --- Functional package management for GNU | ||
| 2 | # Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com> | ||
| 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 | # Test the `guix lint' command-line utility. | ||
| 21 | # | ||
| 22 | |||
| 23 | guix lint --version | ||
| 24 | |||
| 25 | module_dir="t-guix-lint-$$" | ||
| 26 | mkdir "$module_dir" | ||
| 27 | trap "rm -rf $module_dir" EXIT | ||
| 28 | |||
| 29 | |||
| 30 | cat > "$module_dir/foo.scm"<<EOF | ||
| 31 | (define-module (foo) | ||
| 32 | #:use-module (guix packages) | ||
| 33 | #:use-module (gnu packages base)) | ||
| 34 | |||
| 35 | (define-public dummy | ||
| 36 | (package (inherit hello) | ||
| 37 | (name "dummy") | ||
| 38 | (version "42") | ||
| 39 | (synopsis "dummy package") | ||
| 40 | (description "dummy package only used for testing purposes."))) | ||
| 41 | EOF | ||
| 42 | |||
| 43 | export GUIX_PACKAGE_PATH=$module_dir | ||
| 44 | export GUIX_PACKAGE_PATH | ||
| 45 | |||
| 46 | grep_warning () | ||
| 47 | { | ||
| 48 | res=`echo "$1" | grep -E -c "(synopsis|description) should"` | ||
| 49 | echo $res | ||
| 50 | } | ||
| 51 | |||
| 52 | # Three issues with the dummy package: | ||
| 53 | # 1) the synopsis starts with the package name; | ||
| 54 | # 2) the synopsis starts with a lower-case letter; | ||
| 55 | # 3) the description starts with a lower-case letter. | ||
| 56 | |||
| 57 | out=`guix lint dummy 2>&1` | ||
| 58 | if [ `grep_warning "$out"` -ne 3 ] | ||
| 59 | then false; else true; fi | ||
| 60 | |||
| 61 | out=`guix lint -c synopsis dummy 2>&1` | ||
| 62 | if [ `grep_warning "$out"` -ne 2 ] | ||
| 63 | then false; else true; fi | ||
| 64 | |||
| 65 | out=`guix lint -c description dummy 2>&1` | ||
| 66 | if [ `grep_warning "$out"` -ne 1 ] | ||
| 67 | then false; else true; fi | ||
| 68 | |||
| 69 | out=`guix lint -c description,synopsis dummy 2>&1` | ||
| 70 | if [ `grep_warning "$out"` -ne 3 ] | ||
| 71 | then false; else true; fi | ||
| 72 | |||
| 73 | if guix lint -c synopsis,invalid-checker dummy 2>&1 | \ | ||
| 74 | grep -q 'invalid-checker: invalid checker' | ||
| 75 | then true; else false; fi | ||
