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

Side by Side Diff: tests/git_cl_test.py

Issue 14265007: Fix R= line handling when there is no value and improve presubmit TAG line regex (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Also check no trigger on whitespace Created 7 years, 8 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 | Annotate | Revision Log
« 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/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 git_cl.py.""" 6 """Unit tests for git_cl.py."""
7 7
8 import os 8 import os
9 import StringIO 9 import StringIO
10 import stat 10 import stat
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 ] 605 ]
606 git_cl.main(['config']) 606 git_cl.main(['config'])
607 607
608 def test_update_reviewers(self): 608 def test_update_reviewers(self):
609 data = [ 609 data = [
610 ('foo', [], 'foo'), 610 ('foo', [], 'foo'),
611 ('foo', ['a@c'], 'foo\n\nR=a@c'), 611 ('foo', ['a@c'], 'foo\n\nR=a@c'),
612 ('foo\nBUG=', ['a@c'], 'foo\nBUG=\nR=a@c'), 612 ('foo\nBUG=', ['a@c'], 'foo\nBUG=\nR=a@c'),
613 ('foo\nR=xx\nTBR=yy\nR=bar', ['a@c'], 'foo\nTBR=a@c'), 613 ('foo\nR=xx\nTBR=yy\nR=bar', ['a@c'], 'foo\nTBR=a@c'),
614 ('foo', ['a@c', 'b@c'], 'foo\n\nR=a@c, b@c'), 614 ('foo', ['a@c', 'b@c'], 'foo\n\nR=a@c, b@c'),
615 ('foo\nBar\n\nR=\nBUG=', ['c@c'], 'foo\nBar\n\nR=c@c\nBUG='),
616 ('foo\nBar\n\nR=\nBUG=\nR=', ['c@c'], 'foo\nBar\n\nR=c@c\nBUG='),
617 # Same as the line before, but full of whitespaces.
618 (
619 'foo\nBar\n\n R = \n BUG = \n R = ', ['c@c'],
620 'foo\nBar\n\nR=c@c\n BUG =',
621 ),
622 # Whitespaces aren't interpreted as new lines.
623 ('foo BUG=allo R=joe ', ['c@c'], 'foo BUG=allo R=joe\n\nR=c@c'),
615 ] 624 ]
616 for orig, reviewers, expected in data: 625 expected = [i[2] for i in data]
626 actual = []
627 for orig, reviewers, _expected in data:
617 obj = git_cl.ChangeDescription(orig) 628 obj = git_cl.ChangeDescription(orig)
618 obj.update_reviewers(reviewers) 629 obj.update_reviewers(reviewers)
619 self.assertEqual(expected, obj.description) 630 actual.append(obj.description)
631 self.assertEqual(expected, actual)
620 632
621 633
622 if __name__ == '__main__': 634 if __name__ == '__main__':
623 git_cl.logging.basicConfig( 635 git_cl.logging.basicConfig(
624 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 636 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
625 unittest.main() 637 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