Chromium Code Reviews| 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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1821 def testCannedCheckLongLines(self): | 1821 def testCannedCheckLongLines(self): |
| 1822 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 1822 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 1823 self.ContentTest(check, '0123456789', None, '01234567890', None, | 1823 self.ContentTest(check, '0123456789', None, '01234567890', None, |
| 1824 presubmit.OutputApi.PresubmitPromptWarning) | 1824 presubmit.OutputApi.PresubmitPromptWarning) |
| 1825 | 1825 |
| 1826 def testCannedCheckJavaLongLines(self): | 1826 def testCannedCheckJavaLongLines(self): |
| 1827 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y) | 1827 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y) |
| 1828 self.ContentTest(check, 'A ' * 50, 'foo.java', 'A ' * 50 + 'B', 'foo.java', | 1828 self.ContentTest(check, 'A ' * 50, 'foo.java', 'A ' * 50 + 'B', 'foo.java', |
| 1829 presubmit.OutputApi.PresubmitPromptWarning) | 1829 presubmit.OutputApi.PresubmitPromptWarning) |
| 1830 | 1830 |
| 1831 def testCannedCheckSpecialJavaLongLines(self): | |
| 1832 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y) | |
| 1833 self.ContentTest(check, 'import ' + 'A ' * 50, 'foo.java', | |
|
M-A Ruel
2012/10/09 21:39:11
Put 150 to be make it clear that any line length w
| |
| 1834 'importSomething ' + 'A ' * 50, 'foo.java', | |
| 1835 presubmit.OutputApi.PresubmitPromptWarning) | |
| 1836 | |
| 1831 def testCannedCheckLongLinesLF(self): | 1837 def testCannedCheckLongLinesLF(self): |
| 1832 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 1838 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 1833 self.ContentTest(check, '012345678\n', None, '0123456789\n', None, | 1839 self.ContentTest(check, '012345678\n', None, '0123456789\n', None, |
| 1834 presubmit.OutputApi.PresubmitPromptWarning) | 1840 presubmit.OutputApi.PresubmitPromptWarning) |
| 1835 | 1841 |
| 1836 def testCannedCheckLongLinesMacro(self): | 1842 def testCannedCheckLongLinesMacro(self): |
| 1837 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 1843 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 1838 self.ContentTest( | 1844 self.ContentTest( |
| 1839 check, | 1845 check, |
| 1840 # Put a space in so it doesn't trigger long symbols. Allow 1/3 more. | 1846 # Put a space in so it doesn't trigger long symbols. Allow 1/3 more. |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2478 owners_check=False) | 2484 owners_check=False) |
| 2479 self.assertEqual(1, len(results)) | 2485 self.assertEqual(1, len(results)) |
| 2480 self.assertEqual( | 2486 self.assertEqual( |
| 2481 'Found line ending with white spaces in:', results[0]._message) | 2487 'Found line ending with white spaces in:', results[0]._message) |
| 2482 self.checkstdout('') | 2488 self.checkstdout('') |
| 2483 | 2489 |
| 2484 | 2490 |
| 2485 if __name__ == '__main__': | 2491 if __name__ == '__main__': |
| 2486 import unittest | 2492 import unittest |
| 2487 unittest.main() | 2493 unittest.main() |
| OLD | NEW |