X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=apps%2Fpatchwork%2Ftests%2Ftest_patchparser.py;h=119936acab1e44519f0e32afa970ebb3cbb0361a;hb=86f645abb13ff65ef04b085b443168d5b5622e4d;hp=d9a24c1933b866d1397c5b5a8658c4f7b881980a;hpb=93aa30e45f7502f3209bf5ebf4e7966ff5a26899;p=patchwork 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>'