[PATCH 2 of 3] run-tests: make it possible to combine (esc) with (glob) and (re)
Mads Kiilerich
mads at kiilerich.com
Sun Oct 14 19:45:27 CDT 2012
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1350232242 -7200
# Node ID 46a5c837b3eb36e3d0c96974069bd3d97f0dc975
# Parent b49d886bbc64ed0b4bd02f4df60db9175b3f5e80
run-tests: make it possible to combine (esc) with (glob) and (re)
This makes it possible to combine the annotations ... if done in the right
order.
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -526,14 +526,14 @@
def linematch(el, l):
if el == l: # perfect match (fast)
return True
- if (el and
- (el.endswith(" (re)\n") and rematch(el[:-6], l) or
- el.endswith(" (glob)\n") and globmatch(el[:-8], l) or
- el.endswith(" (esc)\n") and
- (el[:-7].decode('string-escape') + '\n' == l or
- os.name == 'nt' and
- el[:-7].decode('string-escape') + '\n' == l))):
- return True
+ if el:
+ if el.endswith(" (esc)\n"):
+ el = el[:-7].decode('string-escape') + '\n'
+ if el == l or os.name == 'nt' and el[:-1] + '\r\n' == l:
+ return True
+ if (el.endswith(" (re)\n") and rematch(el[:-6], l) or
+ el.endswith(" (glob)\n") and globmatch(el[:-8], l)):
+ return True
return False
def tsttest(test, wd, options, replacements):
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -62,6 +62,18 @@
crcrlf\r (esc)
#endif
+Combining esc with other markups - and handling lines ending with \r instead of \n:
+
+ $ printf 'foo/bar\r'
+ foo/bar\r (no-eol) (glob) (esc)
+#if windows
+ $ printf 'foo\\bar\r'
+ foo/bar\r (no-eol) (glob) (esc)
+#endif
+ $ printf 'foo/bar\rfoo/bar\r'
+ foo.bar\r \(no-eol\) (re) (esc)
+ foo.bar\r \(no-eol\) (re)
+
testing hghave
$ "$TESTDIR/hghave" true
More information about the Mercurial-devel
mailing list