OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 presubmit_support.py and presubmit_canned_checks.py.""" | 6 """Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" |
7 | 7 |
8 # pylint: disable=E1101,E1103 | 8 # pylint: disable=E1101,E1103 |
9 | 9 |
10 import StringIO | 10 import StringIO |
(...skipping 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2889 (0, 'Hey!\n'), | 2889 (0, 'Hey!\n'), |
2890 (1, 'Ho!\n'), | 2890 (1, 'Ho!\n'), |
2891 (2, 'Hey!\n'), | 2891 (2, 'Hey!\n'), |
2892 (3, 'Ho!\n'), | 2892 (3, 'Ho!\n'), |
2893 (4, '\n')]) | 2893 (4, '\n')]) |
2894 for _ in range(5): | 2894 for _ in range(5): |
2895 affected_file.LocalPath().AndReturn('hello.py') | 2895 affected_file.LocalPath().AndReturn('hello.py') |
2896 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file]) | 2896 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file]) |
2897 input_api.ReadFile(affected_file).AndReturn('Hey!\nHo!\nHey!\nHo!\n\n') | 2897 input_api.ReadFile(affected_file).AndReturn('Hey!\nHo!\nHey!\nHo!\n\n') |
2898 | 2898 |
| 2899 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file]) |
| 2900 |
| 2901 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file]) |
| 2902 input_api.ReadFile(affected_file, 'rb').AndReturn( |
| 2903 'Hey!\nHo!\nHey!\nHo!\n\n') |
| 2904 affected_file.LocalPath() |
| 2905 |
2899 self.mox.ReplayAll() | 2906 self.mox.ReplayAll() |
2900 results = presubmit_canned_checks.PanProjectChecks( | 2907 results = presubmit_canned_checks.PanProjectChecks( |
2901 input_api, | 2908 input_api, |
2902 presubmit.OutputApi, | 2909 presubmit.OutputApi, |
2903 excluded_paths=None, | 2910 excluded_paths=None, |
2904 text_files=None, | 2911 text_files=None, |
2905 license_header=None, | 2912 license_header=None, |
2906 project_name=None, | 2913 project_name=None, |
2907 owners_check=False) | 2914 owners_check=False) |
2908 self.assertEqual(1, len(results)) | 2915 self.assertEqual(2, len(results)) |
2909 self.assertEqual( | 2916 self.assertEqual( |
2910 'Found line ending with white spaces in:', results[0]._message) | 2917 'Found line ending with white spaces in:', results[0]._message) |
2911 self.checkstdout('') | 2918 self.checkstdout('') |
2912 | 2919 |
2913 | 2920 |
2914 if __name__ == '__main__': | 2921 if __name__ == '__main__': |
2915 import unittest | 2922 import unittest |
2916 unittest.main() | 2923 unittest.main() |
OLD | NEW |