Chromium Code Reviews

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: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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...)
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='),
iannucci 2013/04/18 18:25:16 Should there be tests to make sure that the newlin
M-A Ruel 2013/04/19 16:58:42 Added more checks to ensure no regression.
615 ] 617 ]
616 for orig, reviewers, expected in data: 618 expected = [i[2] for i in data]
619 actual = []
620 for orig, reviewers, _expected in data:
617 obj = git_cl.ChangeDescription(orig) 621 obj = git_cl.ChangeDescription(orig)
618 obj.update_reviewers(reviewers) 622 obj.update_reviewers(reviewers)
619 self.assertEqual(expected, obj.description) 623 actual.append(obj.description)
624 self.assertEqual(expected, actual)
620 625
621 626
622 if __name__ == '__main__': 627 if __name__ == '__main__':
623 git_cl.logging.basicConfig( 628 git_cl.logging.basicConfig(
624 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 629 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
625 unittest.main() 630 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