Rev 203: Added test for nonsense patch input. in http://bzr.daniel-watkins.co.uk/pqm/abstract-patch

Daniel Watkins daniel at daniel-watkins.co.uk
Sun Jul 20 16:42:53 BST 2008


At http://bzr.daniel-watkins.co.uk/pqm/abstract-patch

------------------------------------------------------------
revno: 203
revision-id: daniel at daniel-watkins.co.uk-20080720154125-l9swnh5sjv2taakp
parent: daniel at daniel-watkins.co.uk-20080720153107-cstlnsfbvuey2opo
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: abstract-patch
timestamp: Sun 2008-07-20 16:41:25 +0100
message:
  Added test for nonsense patch input.
-------------- next part --------------
=== modified file 'pqm/tests/test_pqm.py'
--- a/pqm/tests/test_pqm.py	2008-07-20 15:31:07 +0000
+++ b/pqm/tests/test_pqm.py	2008-07-20 15:41:25 +0000
@@ -384,6 +384,28 @@
         command.run()
         self.assertFileEqual('foo\n', 'bar/foo/foo/bar')
 
+    def test_PatchCommand_nonsense_patch(self):
+        configp, tree = self.set_up()
+        self.build_tree_contents([('foo/bar', '')])
+        tree.smart_add(['foo/bar'])
+        tree.commit("Add bar.")
+
+        patch = ["`Twas brillig, and the slithy toves",
+                 "  Did gyre and gimble in the wabe;",
+                 "All mimsy were the borogoves,",
+                 "  And the mome raths outgrabe."]
+
+        script = MockScript()
+        handler = pqm.BranchSpecOptionHandler(configp, queuedir='queue')
+        command = PatchCommand(script, handler, configp, patch, 'foo')
+        e = self.assertRaises(PQMException, command.run)
+        self.assertEqual(
+            "['patch command \"patch\" failed (512): patch exited with error"
+            " code 2', 'patch: **** Only garbage was found in the patch"
+            " input.\\n']",
+            str(e))
+
+
 class FunctionalTestCommandRunner(unittest.TestCase):
 
     def setUp(self):



More information about the bazaar-commits mailing list