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

Side by Side Diff: tests/git_cl_test.py

Issue 23072039: Fix R= line rewriter to handle TBRs well. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Nits Created 7 years, 3 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 | « git_cl.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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 ((['git', 'config', 'rietveld.viewvc-url'],), ''), 685 ((['git', 'config', 'rietveld.viewvc-url'],), ''),
686 (('ViewVC URL:',), ''), 686 (('ViewVC URL:',), ''),
687 # DownloadHooks(True) 687 # DownloadHooks(True)
688 ((commit_msg_path, os.X_OK,), True), 688 ((commit_msg_path, os.X_OK,), True),
689 ] 689 ]
690 git_cl.main(['config']) 690 git_cl.main(['config'])
691 691
692 def test_update_reviewers(self): 692 def test_update_reviewers(self):
693 data = [ 693 data = [
694 ('foo', [], 'foo'), 694 ('foo', [], 'foo'),
695 ('foo\nR=xx', [], 'foo\nR=xx'),
696 ('foo\nTBR=xx', [], 'foo\nTBR=xx'),
695 ('foo', ['a@c'], 'foo\n\nR=a@c'), 697 ('foo', ['a@c'], 'foo\n\nR=a@c'),
698 ('foo\nR=xx', ['a@c'], 'foo\n\nR=a@c, xx'),
699 ('foo\nTBR=xx', ['a@c'], 'foo\n\nR=a@c\nTBR=xx'),
700 ('foo\nTBR=xx\nR=yy', ['a@c'], 'foo\n\nR=a@c, yy\nTBR=xx'),
696 ('foo\nBUG=', ['a@c'], 'foo\nBUG=\nR=a@c'), 701 ('foo\nBUG=', ['a@c'], 'foo\nBUG=\nR=a@c'),
697 ('foo\nR=xx\nTBR=yy\nR=bar', ['a@c'], 'foo\nTBR=a@c'), 702 ('foo\nR=xx\nTBR=yy\nR=bar', ['a@c'], 'foo\n\nR=a@c, xx, bar\nTBR=yy'),
698 ('foo', ['a@c', 'b@c'], 'foo\n\nR=a@c, b@c'), 703 ('foo', ['a@c', 'b@c'], 'foo\n\nR=a@c, b@c'),
699 ('foo\nBar\n\nR=\nBUG=', ['c@c'], 'foo\nBar\n\nR=c@c\nBUG='), 704 ('foo\nBar\n\nR=\nBUG=', ['c@c'], 'foo\nBar\n\nR=c@c\nBUG='),
700 ('foo\nBar\n\nR=\nBUG=\nR=', ['c@c'], 'foo\nBar\n\nR=c@c\nBUG='), 705 ('foo\nBar\n\nR=\nBUG=\nR=', ['c@c'], 'foo\nBar\n\nR=c@c\nBUG='),
701 # Same as the line before, but full of whitespaces. 706 # Same as the line before, but full of whitespaces.
702 ( 707 (
703 'foo\nBar\n\n R = \n BUG = \n R = ', ['c@c'], 708 'foo\nBar\n\n R = \n BUG = \n R = ', ['c@c'],
704 'foo\nBar\n\nR=c@c\n BUG =', 709 'foo\nBar\n\nR=c@c\n BUG =',
705 ), 710 ),
706 # Whitespaces aren't interpreted as new lines. 711 # Whitespaces aren't interpreted as new lines.
707 ('foo BUG=allo R=joe ', ['c@c'], 'foo BUG=allo R=joe\n\nR=c@c'), 712 ('foo BUG=allo R=joe ', ['c@c'], 'foo BUG=allo R=joe\n\nR=c@c'),
708 ] 713 ]
709 expected = [i[2] for i in data] 714 expected = [i[2] for i in data]
710 actual = [] 715 actual = []
711 for orig, reviewers, _expected in data: 716 for orig, reviewers, _expected in data:
712 obj = git_cl.ChangeDescription(orig) 717 obj = git_cl.ChangeDescription(orig)
713 obj.update_reviewers(reviewers) 718 obj.update_reviewers(reviewers)
714 actual.append(obj.description) 719 actual.append(obj.description)
715 self.assertEqual(expected, actual) 720 self.assertEqual(expected, actual)
716 721
717 722
718 if __name__ == '__main__': 723 if __name__ == '__main__':
719 git_cl.logging.basicConfig( 724 git_cl.logging.basicConfig(
720 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 725 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
721 unittest.main() 726 unittest.main()
OLDNEW
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698