# HG changeset patch # User Gregory Szorc # Date 1549318612 28800 # Node ID 99b4c6d73a720c0d30239b95a6e4f9e23f0691a6 # Parent 033a0f4b4a5fd8e132ce6c0c310fbafdb52bce8b 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 diff -r 033a0f4b4a5f -r 99b4c6d73a72 contrib/testparseutil.py --- 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 <