summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/tests/test_patchparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'apps/patchwork/tests/test_patchparser.py')
-rw-r--r--apps/patchwork/tests/test_patchparser.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/patchwork/tests/test_patchparser.py b/apps/patchwork/tests/test_patchparser.py
index d9a24c1..119936a 100644
--- a/apps/patchwork/tests/test_patchparser.py
+++ b/apps/patchwork/tests/test_patchparser.py
@@ -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>'