summaryrefslogtreecommitdiff
path: root/src/pyparsing.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2016-09-11 16:31:34 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2016-09-11 16:31:34 +0000
commit8527787d2906aa91d8e05f829c27481b797f75f9 (patch)
tree43eff6aaad40392c5a3d25e85a3efdd835778da6 /src/pyparsing.py
parentec02b784583d971117910ba8b4c51426dfae5885 (diff)
downloadpyparsing-git-8527787d2906aa91d8e05f829c27481b797f75f9.tar.gz
Added support for multiline test strings in runTests
Diffstat (limited to 'src/pyparsing.py')
-rw-r--r--src/pyparsing.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pyparsing.py b/src/pyparsing.py
index 70fe4eb..5517d02 100644
--- a/src/pyparsing.py
+++ b/src/pyparsing.py
@@ -61,7 +61,7 @@ The pyparsing module handles some of the problems that are typically vexing when
"""
__version__ = "2.1.10"
-__versionTime__ = "11 Sep 2016 01:15 UTC"
+__versionTime__ = "11 Sep 2016 16:20 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -2267,6 +2267,13 @@ class ParserElement(object):
FAIL: Expected end of text (at char 4), (line:1, col:5)
Success
+
+ Each test string must be on a single line. If you want to test a string that spans multiple
+ lines, create a test like this::
+
+ expr.runTest(r"this is a test\n of strings that spans \n 3 lines")
+
+ (Note that this is a raw string literal, you must include the leading 'r'.)
"""
if isinstance(tests, basestring):
tests = list(map(str.strip, tests.rstrip().splitlines()))
@@ -2284,6 +2291,7 @@ class ParserElement(object):
out = ['\n'.join(comments), t]
comments = []
try:
+ t = t.replace(r'\n','\n')
result = self.parseString(t, parseAll=parseAll)
out.append(result.dump(full=fullDump))
success = success and not failureTests