| 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=
|
|
|