OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Unit tests for patch.py.""" | 6 """Unit tests for patch.py.""" |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import unittest | 10 import unittest |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 self.assertEquals(c.patchlevel, 1) | 185 self.assertEquals(c.patchlevel, 1) |
186 self.assertEquals(c.get(), diff) | 186 self.assertEquals(c.get(), diff) |
187 | 187 |
188 def testFilePatchBadDiff(self): | 188 def testFilePatchBadDiff(self): |
189 try: | 189 try: |
190 patch.FilePatchDiff('foo', 'data', []) | 190 patch.FilePatchDiff('foo', 'data', []) |
191 self.fail() | 191 self.fail() |
192 except patch.UnsupportedPatchFormat: | 192 except patch.UnsupportedPatchFormat: |
193 pass | 193 pass |
194 | 194 |
| 195 def testFilePatchNoDiff(self): |
| 196 try: |
| 197 patch.FilePatchDiff('foo', '', []) |
| 198 self.fail() |
| 199 except patch.UnsupportedPatchFormat: |
| 200 pass |
| 201 |
| 202 def testFilePatchNoneDiff(self): |
| 203 try: |
| 204 patch.FilePatchDiff('foo', None, []) |
| 205 self.fail() |
| 206 except patch.UnsupportedPatchFormat: |
| 207 pass |
| 208 |
195 def testFilePatchBadDiffName(self): | 209 def testFilePatchBadDiffName(self): |
196 try: | 210 try: |
197 patch.FilePatchDiff('foo', SVN_PATCH, []) | 211 patch.FilePatchDiff('foo', SVN_PATCH, []) |
198 self.fail() | 212 self.fail() |
199 except patch.UnsupportedPatchFormat: | 213 except patch.UnsupportedPatchFormat: |
200 pass | 214 pass |
201 | 215 |
202 def testInvalidFilePatchDiffGit(self): | 216 def testInvalidFilePatchDiffGit(self): |
203 try: | 217 try: |
204 patch.FilePatchDiff('svn_utils_test.txt', ( | 218 patch.FilePatchDiff('svn_utils_test.txt', ( |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 patch.FilePatchDiff( | 361 patch.FilePatchDiff( |
348 'chrome/browser/chromeos/views/webui_menu_widget.h', | 362 'chrome/browser/chromeos/views/webui_menu_widget.h', |
349 GIT_RENAME_PARTIAL, []) | 363 GIT_RENAME_PARTIAL, []) |
350 patch.FilePatchDiff('pp', GIT_COPY, []) | 364 patch.FilePatchDiff('pp', GIT_COPY, []) |
351 patch.FilePatchDiff('foo', GIT_NEW, []) | 365 patch.FilePatchDiff('foo', GIT_NEW, []) |
352 self.assertTrue(True) | 366 self.assertTrue(True) |
353 | 367 |
354 | 368 |
355 if __name__ == '__main__': | 369 if __name__ == '__main__': |
356 unittest.main() | 370 unittest.main() |
OLD | NEW |