changeset 21023:57b50abe2b24

tests: warn on invalid #if directive
author Mads Kiilerich <madski@unity3d.com>
date Sun, 13 Apr 2014 19:01:00 +0200
parents 52e9e63f1495
children 7731a2281cf0
files tests/run-tests.py tests/test-permissions.t
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Mon Nov 25 22:00:46 2013 +0100
+++ b/tests/run-tests.py	Sun Apr 13 19:01:00 2014 +0200
@@ -702,9 +702,12 @@
         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:
--- a/tests/test-permissions.t	Mon Nov 25 22:00:46 2013 +0100
+++ b/tests/test-permissions.t	Sun Apr 13 19:01:00 2014 +0200
@@ -1,4 +1,4 @@
-#ifdef unix-permissions no-root
+#if unix-permissions no-root
 
   $ hg init t
   $ cd t