summaryrefslogtreecommitdiff
path: root/cfg.mk
diff options
context:
space:
mode:
authorAssaf Gordon <assafgordon@gmail.com>2018-08-03 23:46:15 -0600
committerAssaf Gordon <assafgordon@gmail.com>2018-08-04 22:09:58 -0600
commit6b3d0d6d37d2e3f768eed4566df7c99e318553ed (patch)
treeddb7fca7a9437ed55658fb9e3ba040e2e4183ce6 /cfg.mk
parentf5364300a6edcbcf1ade9d3c2222e9a3ac10a421 (diff)
downloadsed-6b3d0d6d37d2e3f768eed4566df7c99e318553ed.tar.gz
maint: syntax-check: add various test-related checks
* cfg.mk (sc_prohibit_env_returns, sc_prohibit_perl_hash_quotes, sc_prohibit_verbose_version, sc_prohibit_framework_failure, sc_prohibit_test_backticks, sc_prohibit_test_empty): Copied from coreutils' cfg.mk.
Diffstat (limited to 'cfg.mk')
-rw-r--r--cfg.mk40
1 files changed, 40 insertions, 0 deletions
diff --git a/cfg.mk b/cfg.mk
index ed12766..e586f16 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -230,6 +230,46 @@ sc_prohibit_strncmp:
halt='use STREQ_LEN or STRPREFIX instead of str''ncmp' \
$(_sc_search_regexp)
+# Ensure that env vars are not passed through returns_ as
+# that was seen to fail on FreeBSD /bin/sh at least
+sc_prohibit_env_returns:
+ @prohibit='=[^ ]* returns_ ' \
+ exclude='_ returns_ ' \
+ halt='Passing env vars to returns_ is non portable' \
+ in_vc_files='^tests/' \
+ $(_sc_search_regexp)
+
+sc_prohibit_perl_hash_quotes:
+ @prohibit="\{'[A-Z_]+' *[=}]" \
+ halt="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}" \
+ $(_sc_search_regexp)
+
+# Use print_ver_ (from init.cfg), not open-coded $VERBOSE check.
+sc_prohibit_verbose_version:
+ @prohibit='test "\$$VERBOSE" = yes && .* --version' \
+ halt='use the print_ver_ function instead...' \
+ $(_sc_search_regexp)
+
+
+# Use framework_failure_, not the old name without the trailing underscore.
+sc_prohibit_framework_failure:
+ @prohibit='\<framework_''failure\>' \
+ halt='use framework_failure_ instead' \
+ $(_sc_search_regexp)
+
+# Prohibit the use of `...` in tests/. Use $(...) instead.
+sc_prohibit_test_backticks:
+ @prohibit='`' in_vc_files='^tests/' \
+ halt='use $$(...), not `...` in tests/' \
+ $(_sc_search_regexp)
+
+# Ensure that compare is used to check empty files
+# so that the unexpected contents are displayed
+sc_prohibit_test_empty:
+ @prohibit='test -s.*&&' in_vc_files='^tests/' \
+ halt='use `compare /dev/null ...`, not `test -s ...` in tests/' \
+ $(_sc_search_regexp)
+
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=2 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79