Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: tests/patch_test.py

Issue 10894036: Fix hunk handling for 'default hunk header values'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Add verification code for the number of commas Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing_support/patches_data.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/patch_test.py
diff --git a/tests/patch_test.py b/tests/patch_test.py
index 41ef0cef104036b5f92dde7659c95d60cc6807ee..6aa7cd17be65808b075bf697d8e75bb5caf09526 100755
--- a/tests/patch_test.py
+++ b/tests/patch_test.py
@@ -360,6 +360,19 @@ class PatchTest(unittest.TestCase):
patchset = patch.PatchSet(patches)
self.assertEquals(expected, patchset.filenames)
+ def testGitPatch(self):
+ p = patch.FilePatchDiff('chrome/file.cc', GIT.PATCH, [])
+ self._check_patch(
+ p, 'chrome/file.cc', GIT.PATCH, is_git_diff=True, patchlevel=1,
+ nb_hunks=1)
+
+ def testGitPatchShortHunkHeader(self):
+ p = patch.FilePatchDiff(
+ 'chrome/browser/api/OWNERS', GIT.PATCH_SHORT_HUNK_HEADER, [])
+ self._check_patch(
+ p, 'chrome/browser/api/OWNERS', GIT.PATCH_SHORT_HUNK_HEADER,
+ is_git_diff=True, patchlevel=1, nb_hunks=1)
+
class PatchTestFail(unittest.TestCase):
# All patches that should throw.
@@ -513,6 +526,19 @@ class PatchTestFail(unittest.TestCase):
except patch.UnsupportedPatchFormat:
pass
+ def testBadHunkCommas(self):
+ try:
+ patch.FilePatchDiff(
+ 'file_a',
+ '--- file_a\n'
+ '+++ file_a\n'
+ '@@ -0,,0 +1 @@\n'
+ '+foo\n',
+ [])
+ self.fail()
+ except patch.UnsupportedPatchFormat:
+ pass
+
if __name__ == '__main__':
logging.basicConfig(level=
« no previous file with comments | « testing_support/patches_data.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698