tests: add a syntax check for last week's global change
authorJim Meyering <meyering@redhat.com>
Sun, 27 Nov 2011 14:36:06 +0000 (15:36 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 27 Nov 2011 20:13:18 +0000 (21:13 +0100)
Last week I made a global change, commit a2c811db, `tests: use
"compare exp out", not "compare out exp"', but forgot to add a
corresponding syntax check rule.  Without that, it is far too
easy to add a new test or to merge in an old one that would
be non-conforming.  Obviously this is only a heuristic, since
it relies on the expected-output file to have a name that starts
with "exp".
* cfg.mk (sc_prohibit_reversed_compare_failure): Prohibit use of
compare with reversed arguments.

cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 0626f48..3c42d5d 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -280,6 +280,12 @@ sc_prohibit_framework_failure:
        halt='use framework_failure_ instead'                           \
          $(_sc_search_regexp)
 
+# In tests, use "compare expected actual", not the reverse.
+sc_prohibit_reversed_compare_failure:
+       @prohibit='\<compare [^ ]+ (exp|/dev/null)'                     \
+       halt='reversed compare arguments'                               \
+         $(_sc_search_regexp)
+
 ###########################################################
 _p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
 _pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*