changeset 41552:99b4c6d73a72

testparseutil: escape backslash in docstring This is funky. This inline Python code is part of a docstring, which means the string is interpreted first. So any backslashes need double escaping. So even though this is already a br'', we still need to escape. Differential Revision: https://phab.mercurial-scm.org/D5842
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 04 Feb 2019 14:16:52 -0800
parents 033a0f4b4a5f
children eb14ab7db33e
files contrib/testparseutil.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/testparseutil.py	Mon Feb 04 14:14:25 2019 -0800
+++ b/contrib/testparseutil.py	Mon Feb 04 14:16:52 2019 -0800
@@ -265,7 +265,7 @@
 class fileheredocmatcher(embeddedmatcher):
     """Detect "cat > FILE << LIMIT" style embedded code
 
-    >>> matcher = fileheredocmatcher(b'heredoc .py file', br'[^<]+\.py')
+    >>> matcher = fileheredocmatcher(b'heredoc .py file', br'[^<]+\\.py')
     >>> b2s(matcher.startsat(b'  $ cat > file.py << EOF\\n'))
     ('file.py', '  > EOF\\n')
     >>> b2s(matcher.startsat(b'  $ cat   >>file.py   <<EOF\\n'))