]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/tests/test_patchparser.py
tox: Add tox.ini file
[patchwork] / apps / patchwork / tests / test_patchparser.py
index d9a24c1933b866d1397c5b5a8658c4f7b881980a..119936acab1e44519f0e32afa970ebb3cbb0361a 100644 (file)
@@ -433,6 +433,21 @@ class CharsetFallbackPatchTest(MBoxPatchTest):
         self.assertTrue(patch is not None)
         self.assertTrue(comment is not None)
 
+class NoNewlineAtEndOfFilePatchTest(MBoxPatchTest):
+    mail_file = '0011-no-newline-at-end-of-file.mbox'
+
+    def testPatch(self):
+        (patch, comment) = find_content(self.project, self.mail)
+        self.assertTrue(patch is not None)
+        self.assertTrue(comment is not None)
+        self.assertTrue(patch.content.startswith('diff --git a/tools/testing/selftests/powerpc/Makefile'))
+        # Confirm the trailing no newline marker doesn't end up in the comment
+        self.assertFalse(comment.content.rstrip().endswith('\ No newline at end of file'))
+        # Confirm it's instead at the bottom of the patch
+        self.assertTrue(patch.content.rstrip().endswith('\ No newline at end of file'))
+        # Confirm we got both markers
+        self.assertEqual(2, patch.content.count('\ No newline at end of file'))
+
 class DelegateRequestTest(TestCase):
     patch_filename = '0001-add-line.patch'
     msgid = '<1@example.com>'