comparison tests/run-tests.py @ 20274:7a259dfe24f7

run-tests: print more information on unnecessary glob matching Extend the message with the test name and the approximate line number. (The line number is the one of the command producing the output.) Finding the line to fix is easier now. old message: ...... Info, unnecessary glob: at a/b/c (glob) .. new message: ...... Info, unnecessary glob in test-example.t (after line 9): at a/b/c (glob) .. The test result is still pass as before.
author Simon Heimberg <simohe@besonet.ch>
date Thu, 16 Jan 2014 12:08:57 +0100
parents d9d6cbbeef0d
children 1478a9ce6790
comparison
equal deleted inserted replaced
20273:d9d6cbbeef0d 20274:7a259dfe24f7
604 # The only supported special characters are * and ? plus / which also 604 # The only supported special characters are * and ? plus / which also
605 # matches \ on windows. Escaping of these caracters is supported. 605 # matches \ on windows. Escaping of these caracters is supported.
606 if el + '\n' == l: 606 if el + '\n' == l:
607 if os.altsep: 607 if os.altsep:
608 # matching on "/" is not needed for this line 608 # matching on "/" is not needed for this line
609 log("\nInfo, unnecessary glob: %s (glob)" % el) 609 return '-glob'
610 return True 610 return True
611 i, n = 0, len(el) 611 i, n = 0, len(el)
612 res = '' 612 res = ''
613 while i < n: 613 while i < n:
614 c = el[i] 614 c = el[i]
795 795
796 r = linematch(el, lout) 796 r = linematch(el, lout)
797 if isinstance(r, str): 797 if isinstance(r, str):
798 if r == '+glob': 798 if r == '+glob':
799 lout = el[:-1] + ' (glob)\n' 799 lout = el[:-1] + ' (glob)\n'
800 r = False 800 r = False
801 elif r == '-glob':
802 log('\ninfo, unnecessary glob in %s (after line %d):'
803 ' %s (glob)\n' % (test, pos, el[-1]))
804 r = True # pass on unnecessary glob
805 else:
806 log('\ninfo, unknown linematch result: %r\n' % r)
807 r = False
801 if r: 808 if r:
802 postout.append(" " + el) 809 postout.append(" " + el)
803 else: 810 else:
804 if needescape(lout): 811 if needescape(lout):
805 lout = stringescape(lout.rstrip('\n')) + " (esc)\n" 812 lout = stringescape(lout.rstrip('\n')) + " (esc)\n"