[PATCH 3 of 4 V2] run-tests: print more information on unnecessary glob matching

Simon Heimberg simohe at besonet.ch
Wed Jul 17 20:34:57 CDT 2013


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1374102395 -7200
# Node ID abe95fe9f9767fa4d08605c95e2d1045cf466bb0
# Parent  57165994b6c3c956cbed93115526cd188608f8fd
run-tests: print more information on unnecessary glob matching

Extend the message with the test name and the approximate line number. It now
looks similar to the warning about a missing glob for path matching.

old message:
......
Info, unnecessary glob: at a/b/c (glob)
..

new message:
......
Info, unnecessary glob in test test-example.t (after line 9): at a/b/c (glob)
..

diff -r 57165994b6c3 -r abe95fe9f976 tests/run-tests.py
--- a/tests/run-tests.py	Don Jul 18 01:06:35 2013 +0200
+++ b/tests/run-tests.py	Don Jul 18 01:06:35 2013 +0200
@@ -603,7 +603,7 @@
     if el + '\n' == l:
         if os.altsep:
             # matching on "/" is not needed for this line
-            log("\nInfo, unnecessary glob: %s (glob)" % el)
+            return 'glob'
         return True
     i, n = 0, len(el)
     res = ''
@@ -796,6 +796,9 @@
                 if r == 'slash':
                     log('\nInfo, missing glob in test %s (after line %d): %s'
                         % (test, pos, el))
+                elif r == 'glob':
+                    log('\ninfo, unnecessary glob in test %s (after line %d):'
+                        ' %s (glob)\n' % (test, pos, el[-1]))
             else:
                 if needescape(lout):
                     lout = stringescape(lout.rstrip('\n')) + " (esc)\n"
diff -r 57165994b6c3 -r abe95fe9f976 tests/test-run-tests.py
--- a/tests/test-run-tests.py	Don Jul 18 01:06:35 2013 +0200
+++ b/tests/test-run-tests.py	Don Jul 18 01:06:35 2013 +0200
@@ -46,9 +46,7 @@
 
     direct match, warn
         >>> lm('g/b (glob)\n', 'g/b\n')
-        <BLANKLINE>
-        Info, unnecessary glob: g/b (glob)
-        True
+        'True + warn(glob)'
 
     slash matches backslash, but warn
         >>> lm('/g/c/d/fg\n', '\\g\\c\\d/fg\n')


More information about the Mercurial-devel mailing list