| 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 logging | 10 import logging |
| (...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 input_api1.FilterSourceFile = lambda x: x | 2046 input_api1.FilterSourceFile = lambda x: x |
| 2047 input_api1.AffectedFiles = test | 2047 input_api1.AffectedFiles = test |
| 2048 self.mox.ReplayAll() | 2048 self.mox.ReplayAll() |
| 2049 | 2049 |
| 2050 results1 = presubmit_canned_checks.CheckChangeHasNoTabs(input_api1, | 2050 results1 = presubmit_canned_checks.CheckChangeHasNoTabs(input_api1, |
| 2051 presubmit.OutputApi, None) | 2051 presubmit.OutputApi, None) |
| 2052 self.assertEquals(len(results1), 1) | 2052 self.assertEquals(len(results1), 1) |
| 2053 self.assertEquals(results1[0].__class__, | 2053 self.assertEquals(results1[0].__class__, |
| 2054 presubmit.OutputApi.PresubmitPromptWarning) | 2054 presubmit.OutputApi.PresubmitPromptWarning) |
| 2055 self.assertEquals(results1[0]._long_text, | 2055 self.assertEquals(results1[0]._long_text, |
| 2056 'makefile.foo, line 46') | 2056 'makefile.foo:46') |
| 2057 | 2057 |
| 2058 def testCannedCheckLongLines(self): | 2058 def testCannedCheckLongLines(self): |
| 2059 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2059 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 2060 self.ContentTest(check, '0123456789', None, '01234567890', None, | 2060 self.ContentTest(check, '0123456789', None, '01234567890', None, |
| 2061 presubmit.OutputApi.PresubmitPromptWarning) | 2061 presubmit.OutputApi.PresubmitPromptWarning) |
| 2062 | 2062 |
| 2063 def testCannedCheckJavaLongLines(self): | 2063 def testCannedCheckJavaLongLines(self): |
| 2064 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80) | 2064 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80) |
| 2065 self.ContentTest(check, 'A ' * 50, 'foo.java', 'A ' * 50 + 'B', 'foo.java', | 2065 self.ContentTest(check, 'A ' * 50, 'foo.java', 'A ' * 50 + 'B', 'foo.java', |
| 2066 presubmit.OutputApi.PresubmitPromptWarning) | 2066 presubmit.OutputApi.PresubmitPromptWarning) |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 owners_check=False) | 2724 owners_check=False) |
| 2725 self.assertEqual(1, len(results)) | 2725 self.assertEqual(1, len(results)) |
| 2726 self.assertEqual( | 2726 self.assertEqual( |
| 2727 'Found line ending with white spaces in:', results[0]._message) | 2727 'Found line ending with white spaces in:', results[0]._message) |
| 2728 self.checkstdout('') | 2728 self.checkstdout('') |
| 2729 | 2729 |
| 2730 | 2730 |
| 2731 if __name__ == '__main__': | 2731 if __name__ == '__main__': |
| 2732 import unittest | 2732 import unittest |
| 2733 unittest.main() | 2733 unittest.main() |
| OLD | NEW |