| 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 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 def testCannedCheckLongLinesCssUrl(self): | 2256 def testCannedCheckLongLinesCssUrl(self): |
| 2257 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2257 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 2258 self.ContentTest( | 2258 self.ContentTest( |
| 2259 check, | 2259 check, |
| 2260 ' url(some.png)', | 2260 ' url(some.png)', |
| 2261 'foo.css', | 2261 'foo.css', |
| 2262 ' url(some.png)', | 2262 ' url(some.png)', |
| 2263 'foo.cc', | 2263 'foo.cc', |
| 2264 presubmit.OutputApi.PresubmitPromptWarning) | 2264 presubmit.OutputApi.PresubmitPromptWarning) |
| 2265 | 2265 |
| 2266 def testCannedCheckLongLinesGritInclude(self): |
| 2267 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 2268 self.ContentTest( |
| 2269 check, |
| 2270 '<include src="file.js">', |
| 2271 'foo.js', |
| 2272 'var include = "this test is stupid";', |
| 2273 'bar.js', |
| 2274 presubmit.OutputApi.PresubmitPromptWarning) |
| 2266 | 2275 |
| 2267 def testCannedCheckLongLinesLongSymbol(self): | 2276 def testCannedCheckLongLinesLongSymbol(self): |
| 2268 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2277 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 2269 self.ContentTest( | 2278 self.ContentTest( |
| 2270 check, | 2279 check, |
| 2271 ' TUP5D_LoNG_SY ', | 2280 ' TUP5D_LoNG_SY ', |
| 2272 None, | 2281 None, |
| 2273 ' TUP5D_LoNG_SY5 ', | 2282 ' TUP5D_LoNG_SY5 ', |
| 2274 None, | 2283 None, |
| 2275 presubmit.OutputApi.PresubmitPromptWarning) | 2284 presubmit.OutputApi.PresubmitPromptWarning) |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2919 owners_check=False) | 2928 owners_check=False) |
| 2920 self.assertEqual(1, len(results)) | 2929 self.assertEqual(1, len(results)) |
| 2921 self.assertEqual( | 2930 self.assertEqual( |
| 2922 'Found line ending with white spaces in:', results[0]._message) | 2931 'Found line ending with white spaces in:', results[0]._message) |
| 2923 self.checkstdout('') | 2932 self.checkstdout('') |
| 2924 | 2933 |
| 2925 | 2934 |
| 2926 if __name__ == '__main__': | 2935 if __name__ == '__main__': |
| 2927 import unittest | 2936 import unittest |
| 2928 unittest.main() | 2937 unittest.main() |
| OLD | NEW |