| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2009 Torch Mobile Inc. | 2 # Copyright (C) 2009 Torch Mobile Inc. |
| 3 # Copyright (C) 2009 Apple Inc. All rights reserved. | 3 # Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) | 4 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) |
| 5 # | 5 # |
| 6 # Redistribution and use in source and binary forms, with or without | 6 # Redistribution and use in source and binary forms, with or without |
| 7 # modification, are permitted provided that the following conditions are | 7 # modification, are permitted provided that the following conditions are |
| 8 # met: | 8 # met: |
| 9 # | 9 # |
| 10 # * Redistributions of source code must retain the above copyright | 10 # * Redistributions of source code must retain the above copyright |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 def setUp(self): | 56 def setUp(self): |
| 57 file_reader = self.MockTextFileReader() | 57 file_reader = self.MockTextFileReader() |
| 58 self._file_reader = file_reader | 58 self._file_reader = file_reader |
| 59 self._patch_checker = PatchReader(file_reader) | 59 self._patch_checker = PatchReader(file_reader) |
| 60 | 60 |
| 61 def _call_check_patch(self, patch_string): | 61 def _call_check_patch(self, patch_string): |
| 62 self._patch_checker.check(patch_string) | 62 self._patch_checker.check(patch_string) |
| 63 | 63 |
| 64 def _assert_checked(self, passed_to_process_file, delete_only_file_count): | 64 def _assert_checked(self, passed_to_process_file, delete_only_file_count): |
| 65 self.assertEqual(self._file_reader.passed_to_process_file, | 65 self.assertEqual(self._file_reader.passed_to_process_file, |
| 66 passed_to_process_file) | 66 passed_to_process_file) |
| 67 self.assertEqual(self._file_reader.delete_only_file_count, | 67 self.assertEqual(self._file_reader.delete_only_file_count, |
| 68 delete_only_file_count) | 68 delete_only_file_count) |
| 69 | 69 |
| 70 def test_check_patch(self): | 70 def test_check_patch(self): |
| 71 # The modified line_numbers array for this patch is: [2]. | 71 # The modified line_numbers array for this patch is: [2]. |
| 72 self._call_check_patch("""diff --git a/__init__.py b/__init__.py | 72 self._call_check_patch("""diff --git a/__init__.py b/__init__.py |
| 73 index ef65bee..e3db70e 100644 | 73 index ef65bee..e3db70e 100644 |
| 74 --- a/__init__.py | 74 --- a/__init__.py |
| 75 +++ b/__init__.py | 75 +++ b/__init__.py |
| 76 @@ -1,1 +1,2 @@ | 76 @@ -1,1 +1,2 @@ |
| 77 # Required for Python to search this directory for module files | 77 # Required for Python to search this directory for module files |
| 78 +# New line | 78 +# New line |
| (...skipping 13 matching lines...) Expand all Loading... |
| 92 | 92 |
| 93 def test_check_patch_with_png_deletion(self): | 93 def test_check_patch_with_png_deletion(self): |
| 94 fs = MockFileSystem() | 94 fs = MockFileSystem() |
| 95 diff_text = """Index: LayoutTests/platform/mac/foo-expected.png | 95 diff_text = """Index: LayoutTests/platform/mac/foo-expected.png |
| 96 =================================================================== | 96 =================================================================== |
| 97 Cannot display: file marked as a binary type. | 97 Cannot display: file marked as a binary type. |
| 98 svn:mime-type = image/png | 98 svn:mime-type = image/png |
| 99 """ | 99 """ |
| 100 self._patch_checker.check(diff_text, fs) | 100 self._patch_checker.check(diff_text, fs) |
| 101 self._assert_checked([], 1) | 101 self._assert_checked([], 1) |
| OLD | NEW |