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 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 logging | 10 import logging |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 ], | 1060 ], |
1061 [ | 1061 [ |
1062 # Expected. | 1062 # Expected. |
1063 ], | 1063 ], |
1064 ), | 1064 ), |
1065 ] | 1065 ] |
1066 input_api = presubmit.InputApi( | 1066 input_api = presubmit.InputApi( |
1067 self.fake_change, './PRESUBMIT.py', False, None, False) | 1067 self.fake_change, './PRESUBMIT.py', False, None, False) |
1068 self.mox.ReplayAll() | 1068 self.mox.ReplayAll() |
1069 | 1069 |
1070 self.assertEqual(len(input_api.DEFAULT_WHITE_LIST), 21) | 1070 self.assertEqual(len(input_api.DEFAULT_WHITE_LIST), 22) |
1071 self.assertEqual(len(input_api.DEFAULT_BLACK_LIST), 11) | 1071 self.assertEqual(len(input_api.DEFAULT_BLACK_LIST), 11) |
1072 for item in files: | 1072 for item in files: |
1073 results = filter(input_api.FilterSourceFile, item[0]) | 1073 results = filter(input_api.FilterSourceFile, item[0]) |
1074 for i in range(len(results)): | 1074 for i in range(len(results)): |
1075 self.assertEquals(results[i].LocalPath(), | 1075 self.assertEquals(results[i].LocalPath(), |
1076 presubmit.normpath(item[1][i])) | 1076 presubmit.normpath(item[1][i])) |
1077 # Same number of expected results. | 1077 # Same number of expected results. |
1078 self.assertEquals(sorted([f.LocalPath().replace(presubmit.os.sep, '/') | 1078 self.assertEquals(sorted([f.LocalPath().replace(presubmit.os.sep, '/') |
1079 for f in results]), | 1079 for f in results]), |
1080 sorted(item[1])) | 1080 sorted(item[1])) |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 owners_check=True) | 2283 owners_check=True) |
2284 self.assertEqual(1, len(results)) | 2284 self.assertEqual(1, len(results)) |
2285 self.assertEqual( | 2285 self.assertEqual( |
2286 'Found line ending with white spaces in:', results[0]._message) | 2286 'Found line ending with white spaces in:', results[0]._message) |
2287 self.checkstdout('') | 2287 self.checkstdout('') |
2288 | 2288 |
2289 | 2289 |
2290 if __name__ == '__main__': | 2290 if __name__ == '__main__': |
2291 import unittest | 2291 import unittest |
2292 unittest.main() | 2292 unittest.main() |
OLD | NEW |