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

Unified Diff: tests/git_footers_test.py

Issue 1758943002: Add Gerrit's Change-Id handling to git_footers. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: rebase Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_footers.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_footers_test.py
diff --git a/tests/git_footers_test.py b/tests/git_footers_test.py
index 5cf9ccc5552a1b104d2af292c021ccb56f67992d..bb6e535506949edc841fd60940cbbd64d2cac4f9 100755
--- a/tests/git_footers_test.py
+++ b/tests/git_footers_test.py
@@ -66,5 +66,35 @@ My commit message is my best friend. It is my life. I must master it.
git_footers.get_position(footers),
('refs/branch-heads/blabble', None))
+ def testGetFooterChangeId(self):
+ msg = '\n'.join(['whatever',
+ '',
+ 'Change-Id: ignored',
+ '', # Above is ignored because of this empty line.
+ 'Change-Id: Ideadbeaf'])
+ self.assertEqual(['Ideadbeaf'], git_footers.get_footer_change_id(msg))
+
+ def testAddFooterChangeId(self):
+ self.assertEqual(
+ git_footers.add_footer_change_id('header-only', 'Ixxx'),
+ 'header-only\n\nChange-Id: Ixxx')
+
+ self.assertEqual(
+ git_footers.add_footer_change_id('header\n\nsome: footter', 'Ixxx'),
+ 'header\n\nChange-Id: Ixxx\nsome: footter')
+
+ self.assertEqual(
+ git_footers.add_footer_change_id('header\n\nBUG: yy', 'Ixxx'),
+ 'header\n\nBUG: yy\nChange-Id: Ixxx')
+
+ self.assertEqual(
+ git_footers.add_footer_change_id('header\n\nBUG: yy\nPos: 1', 'Ixxx'),
+ 'header\n\nBUG: yy\nChange-Id: Ixxx\nPos: 1')
+
+ self.assertEqual(
+ git_footers.add_footer_change_id('header\n\nBUG: yy\n\nPos: 1', 'Ixxx'),
+ 'header\n\nBUG: yy\n\nChange-Id: Ixxx\nPos: 1')
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « git_footers.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698