| 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 StringIO | 10 import StringIO |
| (...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2317 "#!/bin/python\n" | 2317 "#!/bin/python\n" |
| 2318 "# Copyright (c) 2037 Nobody.\n" | 2318 "# Copyright (c) 2037 Nobody.\n" |
| 2319 "# All Rights Reserved.\n" | 2319 "# All Rights Reserved.\n" |
| 2320 "print 'foo'\n" | 2320 "print 'foo'\n" |
| 2321 ) | 2321 ) |
| 2322 license_text = ( | 2322 license_text = ( |
| 2323 r".*? Copyright \(c\) 0007 Nobody." "\n" | 2323 r".*? Copyright \(c\) 0007 Nobody." "\n" |
| 2324 r".*? All Rights Reserved\." "\n" | 2324 r".*? All Rights Reserved\." "\n" |
| 2325 ) | 2325 ) |
| 2326 self._LicenseCheck(text, license_text, False, | 2326 self._LicenseCheck(text, license_text, False, |
| 2327 presubmit.OutputApi.PresubmitNotifyResult) | 2327 presubmit.OutputApi.PresubmitPromptWarning) |
| 2328 | 2328 |
| 2329 def testCheckLicenseEmptySuccess(self): | 2329 def testCheckLicenseEmptySuccess(self): |
| 2330 text = '' | 2330 text = '' |
| 2331 license_text = ( | 2331 license_text = ( |
| 2332 r".*? Copyright \(c\) 2037 Nobody." "\n" | 2332 r".*? Copyright \(c\) 2037 Nobody." "\n" |
| 2333 r".*? All Rights Reserved\." "\n" | 2333 r".*? All Rights Reserved\." "\n" |
| 2334 ) | 2334 ) |
| 2335 self._LicenseCheck(text, license_text, True, None, accept_empty_files=True) | 2335 self._LicenseCheck(text, license_text, True, None, accept_empty_files=True) |
| 2336 | 2336 |
| 2337 def testCannedCheckSvnAccidentalSubmission(self): | 2337 def testCannedCheckSvnAccidentalSubmission(self): |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 owners_check=False) | 2914 owners_check=False) |
| 2915 self.assertEqual(2, len(results)) | 2915 self.assertEqual(2, len(results)) |
| 2916 self.assertEqual( | 2916 self.assertEqual( |
| 2917 'Found line ending with white spaces in:', results[0]._message) | 2917 'Found line ending with white spaces in:', results[0]._message) |
| 2918 self.checkstdout('') | 2918 self.checkstdout('') |
| 2919 | 2919 |
| 2920 | 2920 |
| 2921 if __name__ == '__main__': | 2921 if __name__ == '__main__': |
| 2922 import unittest | 2922 import unittest |
| 2923 unittest.main() | 2923 unittest.main() |
| OLD | NEW |