|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (C) 2022-2024 the Eask authors. |
| 4 | + |
| 5 | +# This program is free software; you can redistribute it and/or modify |
| 6 | +# it under the terms of the GNU General Public License as published by |
| 7 | +# the Free Software Foundation; either version 3, or (at your option) |
| 8 | +# any later version. |
| 9 | + |
| 10 | +# This program is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +# GNU General Public License for more details. |
| 14 | + |
| 15 | +# You should have received a copy of the GNU General Public License |
| 16 | +# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 17 | + |
| 18 | +## Commentary: |
| 19 | +# |
| 20 | +# Test command `lint` |
| 21 | +# |
| 22 | + |
| 23 | +set -e |
| 24 | + |
| 25 | +source ./test/fixtures/home/scripts/testing.sh |
| 26 | +cd $(dirname "$0") |
| 27 | + |
| 28 | +# partial input |
| 29 | +should_error eask lint |
| 30 | + |
| 31 | +echo "checkdoc" |
| 32 | +echo "----------" |
| 33 | +should_run eask lint checkdoc declare-ok.el |
| 34 | +# FIXME |
| 35 | +# should_error eask lint checkdoc --strict checkdoc-fail.el |
| 36 | +# should_error eask lint checkdoc --strict --allow-error checkdoc-fail.el declare-ok.el |
| 37 | + |
| 38 | +echo "declare" |
| 39 | +echo "----------" |
| 40 | +should_run eask lint declare declare-ok.el |
| 41 | + |
| 42 | +# warnings are default ignored |
| 43 | +should_run eask lint declare declare-fail.el |
| 44 | + |
| 45 | +# --strict |
| 46 | +# FIXME should exit with error |
| 47 | +# should_error eask lint declare --strict declare-fail.el |
| 48 | + |
| 49 | +# FIXME should exit with error |
| 50 | +# should_error eask lint declare --strict --allow-error ./*.el |
| 51 | + |
| 52 | +echo "elint" |
| 53 | +echo "----------" |
| 54 | + |
| 55 | +should_run eask lint elint declare-ok.el |
| 56 | +# FIXME |
| 57 | +# should_error eask lint elint --strict checkdoc-fail.el |
| 58 | + |
| 59 | +echo "elisp-lint" |
| 60 | +echo "----------" |
| 61 | + |
| 62 | +# no warnings |
| 63 | +should_run eask lint elisp-lint --strict elisp-lint-ok.el |
| 64 | +# warnings |
| 65 | +should_run eask lint elisp-lint declare-ok.el |
| 66 | + |
| 67 | +should_error eask lint elisp-lint --strict declare-ok.el |
| 68 | +OUTPUT="$(should_error eask lint elisp-lint --strict --allow-error checkdoc-fail.el elisp-lint-ok.el )" |
| 69 | +echo "$OUTPUT" |
| 70 | +should_match "2 files linted" "$OUTPUT" |
| 71 | + |
| 72 | +echo "elsa" |
| 73 | +echo "----------" |
| 74 | + |
| 75 | +# no warnings |
| 76 | +should_run eask lint elsa elisp-lint-ok.el |
| 77 | +# warnings |
| 78 | +should_run eask lint elsa elsa-warn.el |
| 79 | +# elsa reports some issues as errors here |
| 80 | +should_error eask lint elsa declare-ok.el |
| 81 | + |
| 82 | +# FIXME |
| 83 | +# should_error eask lint elsa --strict elsa-warn.el |
| 84 | + |
| 85 | +echo "indent" |
| 86 | +echo "----------" |
| 87 | + |
| 88 | +should_run eask lint indent indent-warn.el |
| 89 | +should_error eask lint indent --strict indent-warn.el |
| 90 | +OUTPUT="$(should_error eask lint indent --strict --allow-error indent-warn.el declare-ok.el)" |
| 91 | +echo "$OUTPUT" |
| 92 | +should_match "2 files linted" "$OUTPUT" |
| 93 | + |
| 94 | +echo "keywords" |
| 95 | +echo "----------" |
| 96 | + |
| 97 | +# TODO seems like keywords in actual file are ignored |
| 98 | +# only those in Eask file are checked |
| 99 | +# but those interfere with --strict handling in other commands |
| 100 | +# should_run eask lint keywords |
| 101 | +# should_error eask lint keywords --strict |
| 102 | + |
| 103 | +echo "package" |
| 104 | +echo "----------" |
| 105 | + |
| 106 | +should_run eask lint package declare-ok.el |
| 107 | +# FIXME |
| 108 | +# should_error eask lint package --strict declare-ok.el |
| 109 | + |
| 110 | +# note that all files are checked anyway so --allow-error has no effect |
| 111 | + |
| 112 | +echo "regexps" |
| 113 | +echo "----------" |
| 114 | + |
| 115 | +should_error eask lint regexps regexp-warn.el |
| 116 | +# FIXME regexp throws and is not caught so second file not linted |
| 117 | +# OUTPUT="$(should_error eask lint regexps --allow-error regexp-warn.el declare-ok.el)" |
| 118 | +# echo "$OUTPUT" |
| 119 | +# should_match "2 files linted" "$OUTPUT" |
0 commit comments