| OLD | NEW |
| 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
| 9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
| 10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return self._processor.processed | 72 return self._processor.processed |
| 73 | 73 |
| 74 def _assert_file_reader(self, passed_to_processor, file_count): | 74 def _assert_file_reader(self, passed_to_processor, file_count): |
| 75 """Assert the state of the file reader.""" | 75 """Assert the state of the file reader.""" |
| 76 self.assertEqual(passed_to_processor, self._passed_to_processor()) | 76 self.assertEqual(passed_to_processor, self._passed_to_processor()) |
| 77 self.assertEqual(file_count, self._file_reader.file_count) | 77 self.assertEqual(file_count, self._file_reader.file_count) |
| 78 | 78 |
| 79 def test_process_file__does_not_exist(self): | 79 def test_process_file__does_not_exist(self): |
| 80 try: | 80 try: |
| 81 self._file_reader.process_file('does_not_exist.txt') | 81 self._file_reader.process_file('does_not_exist.txt') |
| 82 except SystemExit, err: | 82 except SystemExit as err: |
| 83 self.assertEqual(str(err), '1') | 83 self.assertEqual(str(err), '1') |
| 84 else: | 84 else: |
| 85 self.fail('No Exception raised.') | 85 self.fail('No Exception raised.') |
| 86 self._assert_file_reader([], 1) | 86 self._assert_file_reader([], 1) |
| 87 self.assertLog(["ERROR: File does not exist: 'does_not_exist.txt'\n"]) | 87 self.assertLog(["ERROR: File does not exist: 'does_not_exist.txt'\n"]) |
| 88 | 88 |
| 89 def test_process_file__is_dir(self): | 89 def test_process_file__is_dir(self): |
| 90 temp_dir = self.filesystem.join(self._temp_dir, 'test_dir') | 90 temp_dir = self.filesystem.join(self._temp_dir, 'test_dir') |
| 91 self.filesystem.maybe_make_directory(temp_dir) | 91 self.filesystem.maybe_make_directory(temp_dir) |
| 92 | 92 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 self._file_reader.process_paths([dir, file_path1]) | 146 self._file_reader.process_paths([dir, file_path1]) |
| 147 processed = [(['bar'], file_path2, None), | 147 processed = [(['bar'], file_path2, None), |
| 148 (['foo'], file_path1, None)] | 148 (['foo'], file_path1, None)] |
| 149 self._assert_file_reader(processed, 2) | 149 self._assert_file_reader(processed, 2) |
| 150 | 150 |
| 151 def test_count_delete_only_file(self): | 151 def test_count_delete_only_file(self): |
| 152 self._file_reader.count_delete_only_file() | 152 self._file_reader.count_delete_only_file() |
| 153 delete_only_file_count = self._file_reader.delete_only_file_count | 153 delete_only_file_count = self._file_reader.delete_only_file_count |
| 154 self.assertEqual(delete_only_file_count, 1) | 154 self.assertEqual(delete_only_file_count, 1) |
| OLD | NEW |