[PATCH 2 of 5 RFC v2] tests: don't match blank output lines as regexes in unified tests

Brodie Rao brodie at bitheap.org
Wed Sep 22 16:11:15 CDT 2010


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1285189559 18000
# Node ID 878b8a0b1405e25018bd9a2626b1950af18938e6
# Parent  08199d4edf6d17c69817f76bdbb40809ac2ed75f
tests: don't match blank output lines as regexes in unified tests

Currently, the following unified test will pass:

  $ echo foo


A blank output line (a line containing just two spaces) will match any
output.

The patch modifies the unified test runner to ignore empty strings
strings when do regular expression matching.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -530,7 +530,7 @@ def tsttest(test, options):
 
             if el == l: # perfect match (fast)
                 postout.append("  " + l)
-            elif el and rematch(el, l): # fallback regex match
+            elif el and el[2:] and rematch(el, l): # fallback regex match
                 postout.append("  " + el)
             else: # mismatch - let diff deal with it
                 postout.append("  " + l)


More information about the Mercurial-devel mailing list