[PATCH 1 of 6 misc] tests: warn on invalid #if directive
Mads Kiilerich
mads at kiilerich.com
Sun Apr 13 12:13:45 CDT 2014
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1397408460 -7200
# Sun Apr 13 19:01:00 2014 +0200
# Node ID 3d61b730ab071141c7ae69b497b343a0023a3b8a
# Parent 40800668e01921e41db1eb97d19e473971e93f5e
tests: warn on invalid #if directive
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -692,9 +692,12 @@ def tsttest(test, wd, options, replaceme
if not l.endswith('\n'):
l += '\n'
if l.startswith('#if'):
+ lsplit = l.split()
+ if len(lsplit) < 2 or lsplit[0] != '#if':
+ after.setdefault(pos, []).append(' !!! invalid #if\n')
if skipping is not None:
after.setdefault(pos, []).append(' !!! nested #if\n')
- skipping = not hghave(l.split()[1:])
+ skipping = not hghave(lsplit[1:])
after.setdefault(pos, []).append(l)
elif l.startswith('#else'):
if skipping is None:
diff --git a/tests/test-permissions.t b/tests/test-permissions.t
--- a/tests/test-permissions.t
+++ b/tests/test-permissions.t
@@ -1,4 +1,4 @@
-#ifdef unix-permissions no-root
+#if unix-permissions no-root
$ hg init t
$ cd t
More information about the Mercurial-devel
mailing list