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 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 def testCannedCheckLongLinesFile(self): | 2246 def testCannedCheckLongLinesFile(self): |
2247 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2247 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
2248 self.ContentTest( | 2248 self.ContentTest( |
2249 check, | 2249 check, |
2250 ' file:// 0 23 5', | 2250 ' file:// 0 23 5', |
2251 None, | 2251 None, |
2252 ' file:// 0 23 56', | 2252 ' file:// 0 23 56', |
2253 None, | 2253 None, |
2254 presubmit.OutputApi.PresubmitPromptWarning) | 2254 presubmit.OutputApi.PresubmitPromptWarning) |
2255 | 2255 |
| 2256 def testCannedCheckLongLinesCssUrl(self): |
| 2257 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
| 2258 self.ContentTest( |
| 2259 check, |
| 2260 ' url(some.png)', |
| 2261 'foo.css', |
| 2262 ' url(some.png)', |
| 2263 'foo.cc', |
| 2264 presubmit.OutputApi.PresubmitPromptWarning) |
| 2265 |
2256 | 2266 |
2257 def testCannedCheckLongLinesLongSymbol(self): | 2267 def testCannedCheckLongLinesLongSymbol(self): |
2258 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) | 2268 check = lambda x, y, z: presubmit_canned_checks.CheckLongLines(x, y, 10, z) |
2259 self.ContentTest( | 2269 self.ContentTest( |
2260 check, | 2270 check, |
2261 ' TUP5D_LoNG_SY ', | 2271 ' TUP5D_LoNG_SY ', |
2262 None, | 2272 None, |
2263 ' TUP5D_LoNG_SY5 ', | 2273 ' TUP5D_LoNG_SY5 ', |
2264 None, | 2274 None, |
2265 presubmit.OutputApi.PresubmitPromptWarning) | 2275 presubmit.OutputApi.PresubmitPromptWarning) |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2909 owners_check=False) | 2919 owners_check=False) |
2910 self.assertEqual(1, len(results)) | 2920 self.assertEqual(1, len(results)) |
2911 self.assertEqual( | 2921 self.assertEqual( |
2912 'Found line ending with white spaces in:', results[0]._message) | 2922 'Found line ending with white spaces in:', results[0]._message) |
2913 self.checkstdout('') | 2923 self.checkstdout('') |
2914 | 2924 |
2915 | 2925 |
2916 if __name__ == '__main__': | 2926 if __name__ == '__main__': |
2917 import unittest | 2927 import unittest |
2918 unittest.main() | 2928 unittest.main() |
OLD | NEW |