summaryrefslogtreecommitdiff
path: root/test/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-01-30 11:46:12 -0500
committerNed Batchelder <ned@nedbatchelder.com>2011-01-30 11:46:12 -0500
commit085f8017a9837c33c1f9e8bc3477d3ed47c1ab4a (patch)
tree71513e7bcbf7da5fd77dfc7c907f01189c6246a5 /test/test_testing.py
parent2e37d40a9eceff624d27e25fe352c7e1855641d1 (diff)
downloadpython-coveragepy-085f8017a9837c33c1f9e8bc3477d3ed47c1ab4a.tar.gz
Add a test for the newline= feature of make_file
Diffstat (limited to 'test/test_testing.py')
-rw-r--r--test/test_testing.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_testing.py b/test/test_testing.py
index 1cae931..67f4412 100644
--- a/test/test_testing.py
+++ b/test/test_testing.py
@@ -109,3 +109,11 @@ class CoverageTestTest(CoverageTest):
# A deeper directory
self.make_file("sub/deeper/evenmore/third.txt")
self.assertEqual(open("sub/deeper/evenmore/third.txt").read(), "")
+
+ def test_make_file_newline(self):
+ self.make_file("unix.txt", "Hello\n")
+ self.assertEqual(open("unix.txt", "rb").read().decode('ascii'), "Hello\n")
+ self.make_file("dos.txt", "Hello\n", newline="\r\n")
+ self.assertEqual(open("dos.txt", "rb").read().decode('ascii'), "Hello\r\n")
+ self.make_file("mac.txt", "Hello\n", newline="\r")
+ self.assertEqual(open("mac.txt", "rb").read().decode('ascii'), "Hello\r")