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

Side by Side Diff: tests/presubmit_unittest.py

Issue 113899: Starts converting GclChange to a method-less class. (Closed)
Patch Set: Fix a small error and unit test Created 11 years, 6 months 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_support.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/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 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 import os 8 import os
9 import StringIO 9 import StringIO
10 import sys 10 import sys
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 'blat.cc', 130 'blat.cc',
131 'foo/haspresubmit/yodle/smart.h', 131 'foo/haspresubmit/yodle/smart.h',
132 'moo/mat/gat/yo.h', 132 'moo/mat/gat/yo.h',
133 'foo/luck.h']) 133 'foo/luck.h'])
134 self.failUnless(len(presubmit_files) == 2) 134 self.failUnless(len(presubmit_files) == 2)
135 self.failUnless(presubmit.normpath('PRESUBMIT.py') in presubmit_files) 135 self.failUnless(presubmit.normpath('PRESUBMIT.py') in presubmit_files)
136 self.failUnless(presubmit.normpath('foo/haspresubmit/PRESUBMIT.py') in 136 self.failUnless(presubmit.normpath('foo/haspresubmit/PRESUBMIT.py') in
137 presubmit_files) 137 presubmit_files)
138 138
139 def testTagLineRe(self): 139 def testTagLineRe(self):
140 m = presubmit._tag_line_re.match(' BUG =1223, 1445 \t') 140 m = presubmit.GclChange._tag_line_re.match(' BUG =1223, 1445 \t')
141 self.failUnless(m) 141 self.failUnless(m)
142 self.failUnlessEqual(m.group('key'), 'BUG') 142 self.failUnlessEqual(m.group('key'), 'BUG')
143 self.failUnlessEqual(m.group('value'), '1223, 1445') 143 self.failUnlessEqual(m.group('value'), '1223, 1445')
144 144
145 def testGclChange(self): 145 def testGclChange(self):
146 description_lines = ('Hello there', 146 description_lines = ('Hello there',
147 'this is a change', 147 'this is a change',
148 'BUG=123', 148 'BUG=123',
149 ' STORY =http://foo/ \t', 149 ' STORY =http://foo/ \t',
150 'and some more regular text \t') 150 'and some more regular text \t')
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 # TODO(maruel): Add real tests. 783 # TODO(maruel): Add real tests.
784 self.failIf(presubmit_canned_checks.RunPythonUnitTests( 784 self.failIf(presubmit_canned_checks.RunPythonUnitTests(
785 self.MockInputApi(), 785 self.MockInputApi(),
786 presubmit.OutputApi, [])) 786 presubmit.OutputApi, []))
787 self.failUnless(presubmit_canned_checks.RunPythonUnitTests( 787 self.failUnless(presubmit_canned_checks.RunPythonUnitTests(
788 self.MockInputApi(), 788 self.MockInputApi(),
789 presubmit.OutputApi, ['non_existent_module'])) 789 presubmit.OutputApi, ['non_existent_module']))
790 790
791 if __name__ == '__main__': 791 if __name__ == '__main__':
792 unittest.main() 792 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_support.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698