Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tests/presubmit_unittest.py

Issue 100163002: Allow obj-c import statements to be as long as necessary. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: The alphabet is confusing. Sort correctly. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
2067 2067
2068 def testCannedCheckSpecialJavaLongLines(self): 2068 def testCannedCheckSpecialJavaLongLines(self):
2069 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80) 2069 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80)
2070 self.ContentTest(check, 'import ' + 'A ' * 150, 'foo.java', 2070 self.ContentTest(check, 'import ' + 'A ' * 150, 'foo.java',
2071 'importSomething ' + 'A ' * 50, 'foo.java', 2071 'importSomething ' + 'A ' * 50, 'foo.java',
2072 presubmit.OutputApi.PresubmitPromptWarning) 2072 presubmit.OutputApi.PresubmitPromptWarning)
2073 2073
2074 def testCannedCheckObjCExceptionLongLines(self):
2075 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80)
2076 self.ContentTest(check, '#import ' + 'A ' * 150, 'foo.mm',
2077 'import' + 'A ' * 150, 'foo.mm',
2078 presubmit.OutputApi.PresubmitPromptWarning)
2079
2074 def testCannedCheckMakefileLongLines(self): 2080 def testCannedCheckMakefileLongLines(self):
2075 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80) 2081 check = lambda x, y, _: presubmit_canned_checks.CheckLongLines(x, y, 80)
2076 self.ContentTest(check, 'A ' * 100, 'foo.mk', 'A ' * 100 + 'B', 'foo.mk', 2082 self.ContentTest(check, 'A ' * 100, 'foo.mk', 'A ' * 100 + 'B', 'foo.mk',
2077 presubmit.OutputApi.PresubmitPromptWarning) 2083 presubmit.OutputApi.PresubmitPromptWarning)
2078 2084
2079 def testCannedCheckLongLinesLF(self): 2085 def testCannedCheckLongLinesLF(self):
2080 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) 2086 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z)
2081 self.ContentTest(check, '012345678\n', None, '0123456789\n', None, 2087 self.ContentTest(check, '012345678\n', None, '0123456789\n', None,
2082 presubmit.OutputApi.PresubmitPromptWarning) 2088 presubmit.OutputApi.PresubmitPromptWarning)
2083 2089
2084 def testCannedCheckLongLinesMacro(self): 2090 def testCannedCheckCppExceptionLongLines(self):
2085 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) 2091 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z)
2086 self.ContentTest( 2092 self.ContentTest(
2087 check, 2093 check,
2088 # Put a space in so it doesn't trigger long symbols. Allow 1/3 more. 2094 '#if 56 89 12 45 9191919191919',
2089 '#if 56 89 12 45', 2095 'foo.cc',
2090 None, 2096 '#nif 56 89 12 45 9191919191919',
2091 '#if 56 89 12 456', 2097 'foo.cc',
2092 None,
2093 presubmit.OutputApi.PresubmitPromptWarning) 2098 presubmit.OutputApi.PresubmitPromptWarning)
2094 2099
2095 def testCannedCheckLongLinesHttp(self): 2100 def testCannedCheckLongLinesHttp(self):
2096 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) 2101 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z)
2097 self.ContentTest( 2102 self.ContentTest(
2098 check, 2103 check,
2099 ' http:// 0 23 5', 2104 ' http:// 0 23 5',
2100 None, 2105 None,
2101 ' http:// 0 23 56', 2106 ' http:// 0 23 56',
2102 None, 2107 None,
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 owners_check=False) 2729 owners_check=False)
2725 self.assertEqual(1, len(results)) 2730 self.assertEqual(1, len(results))
2726 self.assertEqual( 2731 self.assertEqual(
2727 'Found line ending with white spaces in:', results[0]._message) 2732 'Found line ending with white spaces in:', results[0]._message)
2728 self.checkstdout('') 2733 self.checkstdout('')
2729 2734
2730 2735
2731 if __name__ == '__main__': 2736 if __name__ == '__main__':
2732 import unittest 2737 import unittest
2733 unittest.main() 2738 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698