[PATCH 2 of 2 V2] heredoctest: do not append extra newline character to continuation line

Yuya Nishihara yuya at tcha.org
Mon Sep 29 07:17:28 CDT 2014


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1411884815 -32400
#      Sun Sep 28 15:13:35 2014 +0900
# Node ID b3d680392bafa5a3e81009bf2093602936dff623
# Parent  6a5197528c81966ff4c1417a4c9ae4489cb368a4
heredoctest: do not append extra newline character to continuation line

Trailing newline characters are kept in lines.

diff --git a/tests/heredoctest.py b/tests/heredoctest.py
--- a/tests/heredoctest.py
+++ b/tests/heredoctest.py
@@ -10,7 +10,7 @@ while lines:
         snippet = l[4:]
         while lines and lines[0].startswith('... '):
             l = lines.pop(0)
-            snippet += "\n" + l[4:]
+            snippet += l[4:]
         c = compile(snippet, '<heredoc>', 'single')
         try:
             exec c in globalvars
diff --git a/tests/test-unified-test.t b/tests/test-unified-test.t
--- a/tests/test-unified-test.t
+++ b/tests/test-unified-test.t
@@ -42,6 +42,10 @@ Doctest commands:
   ...     print foo, 'should be visible in func()'
   >>> func()
   global name should be visible in func()
+  >>> print '''multiline
+  ... string'''
+  multiline
+  string
 
 Regular expressions:
 


More information about the Mercurial-devel mailing list