tests: warn on invalid #if directive stable
authorMads Kiilerich <madski@unity3d.com>
Sun, 13 Apr 2014 19:01:00 +0200
branchstable
changeset 1368 27b5b55ff3d3
parent 1366 987a80dec7db
child 1369 1161be3ff133
tests: warn on invalid #if directive [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Mon Mar 24 22:12:37 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 13 19:01:00 2014 +0200
@@ -696,9 +696,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: