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 functools | 10 import functools |
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2198 '#if 56 89 12 45 9191919191919', | 2198 '#if 56 89 12 45 9191919191919', |
2199 'foo.cc', | 2199 'foo.cc', |
2200 '#nif 56 89 12 45 9191919191919', | 2200 '#nif 56 89 12 45 9191919191919', |
2201 'foo.cc', | 2201 'foo.cc', |
2202 presubmit.OutputApi.PresubmitPromptWarning) | 2202 presubmit.OutputApi.PresubmitPromptWarning) |
2203 | 2203 |
2204 def testCannedCheckLongLinesHttp(self): | 2204 def testCannedCheckLongLinesHttp(self): |
2205 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2205 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
2206 self.ContentTest( | 2206 self.ContentTest( |
2207 check, | 2207 check, |
2208 ' http:// 0 23 5', | 2208 ' http:// 0 23 56', |
2209 None, | 2209 None, |
2210 ' http:// 0 23 56', | 2210 ' foob:// 0 23 56', |
2211 None, | 2211 None, |
2212 presubmit.OutputApi.PresubmitPromptWarning) | 2212 presubmit.OutputApi.PresubmitPromptWarning) |
2213 | 2213 |
2214 def testCannedCheckLongLinesFile(self): | 2214 def testCannedCheckLongLinesFile(self): |
2215 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2215 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
2216 self.ContentTest( | 2216 self.ContentTest( |
2217 check, | 2217 check, |
2218 ' file:// 0 23 5', | 2218 ' file:// 0 23 56', |
2219 None, | 2219 None, |
2220 ' file:// 0 23 56', | 2220 ' foob:// 0 23 56', |
2221 None, | 2221 None, |
2222 presubmit.OutputApi.PresubmitPromptWarning) | 2222 presubmit.OutputApi.PresubmitPromptWarning) |
2223 | 2223 |
2224 def testCannedCheckLongLinesCssUrl(self): | 2224 def testCannedCheckLongLinesCssUrl(self): |
2225 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2225 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
2226 self.ContentTest( | 2226 self.ContentTest( |
2227 check, | 2227 check, |
2228 ' url(some.png)', | 2228 ' url(some.png)', |
2229 'foo.css', | 2229 'foo.css', |
2230 ' url(some.png)', | 2230 ' url(some.png)', |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2867 owners_check=False) | 2867 owners_check=False) |
2868 self.assertEqual(1, len(results)) | 2868 self.assertEqual(1, len(results)) |
2869 self.assertEqual( | 2869 self.assertEqual( |
2870 'Found line ending with white spaces in:', results[0]._message) | 2870 'Found line ending with white spaces in:', results[0]._message) |
2871 self.checkstdout('') | 2871 self.checkstdout('') |
2872 | 2872 |
2873 | 2873 |
2874 if __name__ == '__main__': | 2874 if __name__ == '__main__': |
2875 import unittest | 2875 import unittest |
2876 unittest.main() | 2876 unittest.main() |
OLD | NEW |