summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-08-03 23:28:00 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-08-03 23:28:00 (GMT)
commit7b3f0fa68e320253e7dc6987c54206272ffb182a (patch)
tree6d44a1a1153a2055b99f4817150bb380890d1aa1 /Lib/test
parentd1f9352bd4b30ccfe665109b1341433a00dc6256 (diff)
downloadcpython-7b3f0fa68e320253e7dc6987c54206272ffb182a.zip
cpython-7b3f0fa68e320253e7dc6987c54206272ffb182a.tar.gz
cpython-7b3f0fa68e320253e7dc6987c54206272ffb182a.tar.bz2
Close #13119: use "\r\n" newline for sys.stdout/err on Windows
sys.stdout and sys.stderr are now using "\r\n" newline on Windows, as Python 2.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_cmd_line.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 8c960b1..7644db2 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -259,6 +259,23 @@ class CmdLineTest(unittest.TestCase):
"print(repr(input()))",
b"'abc'")
+ def test_output_newline(self):
+ # Issue 13119 Newline for print() should be \r\n on Windows.
+ code = """if 1:
+ import sys
+ print(1)
+ print(2)
+ print(3, file=sys.stderr)
+ print(4, file=sys.stderr)"""
+ rc, out, err = assert_python_ok('-c', code)
+
+ if sys.platform == 'win32':
+ self.assertEqual(b'1\r\n2\r\n', out)
+ self.assertEqual(b'3\r\n4', err)
+ else:
+ self.assertEqual(b'1\n2\n', out)
+ self.assertEqual(b'3\n4', err)
+
def test_unmached_quote(self):
# Issue #10206: python program starting with unmatched quote
# spewed spaces to stdout