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

Unified Diff: tools/push-to-trunk/test_scripts.py

Issue 65933003: Refactor and improve bug line generation for push-to-trunk. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Created 7 years, 1 month 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 | « tools/push-to-trunk/common_includes.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/test_scripts.py
diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py
index b9d762d8629fc5a28c7da5ed65fd25f4a8327245..b44c70b2241c0c2b637bf20b49f4dd0624e6d600 100644
--- a/tools/push-to-trunk/test_scripts.py
+++ b/tools/push-to-trunk/test_scripts.py
@@ -52,6 +52,101 @@ TEST_CONFIG = {
}
+class ToplevelTest(unittest.TestCase):
+ def testMakeChangeLogBodySimple(self):
+ commits = lambda: [
+ [" Title text 1",
+ "Title text 1\n\nBUG=\n",
+ " author1@chromium.org"],
+ [" Title text 2",
+ "Title text 2\n\nBUG=1234\n",
+ " author2@chromium.org"],
+ ]
+ self.assertEquals(" Title text 1\n"
+ " author1@chromium.org\n\n"
+ " Title text 2\n"
+ " (Chromium issue 1234)\n"
+ " author2@chromium.org\n\n",
+ MakeChangeLogBody(commits))
+
+ def testMakeChangeLogBodyEmpty(self):
+ commits = lambda: []
+ self.assertEquals("", MakeChangeLogBody(commits))
+
+ def testMakeChangeLogBugReferenceEmpty(self):
+ self.assertEquals("", MakeChangeLogBugReference(""))
+ self.assertEquals("", MakeChangeLogBugReference("LOG="))
+ self.assertEquals("", MakeChangeLogBugReference(" BUG ="))
+ self.assertEquals("", MakeChangeLogBugReference("BUG=none\t"))
+
+ def testMakeChangeLogBugReferenceSimple(self):
+ self.assertEquals(" (issue 987654)\n",
+ MakeChangeLogBugReference("BUG = v8:987654"))
+ self.assertEquals(" (Chromium issue 987654)\n",
+ MakeChangeLogBugReference("BUG=987654 "))
+
+ def testMakeChangeLogBugReferenceFromBody(self):
+ self.assertEquals(" (Chromium issue 1234567)\n",
+ MakeChangeLogBugReference("Title\n\nTBR=\nBUG=\n"
+ " BUG=\tchromium:1234567\t\n"
+ "R=somebody\n"))
+
+ def testMakeChangeLogBugReferenceMultiple(self):
+ # All issues should be sorted and grouped. Multiple references to the same
+ # issue should be filtered.
+ self.assertEquals(" (issues 123, 234, Chromium issue 345)\n",
+ MakeChangeLogBugReference("Title\n\n"
+ "BUG=v8:234\n"
+ " BUG\t= 345, \tv8:234,\n"
+ "BUG=v8:123\n"
+ "R=somebody\n"))
+ self.assertEquals(" (Chromium issues 123, 234)\n",
+ MakeChangeLogBugReference("Title\n\n"
+ "BUG=234,,chromium:123 \n"
+ "R=somebody\n"))
+ self.assertEquals(" (Chromium issues 123, 234)\n",
+ MakeChangeLogBugReference("Title\n\n"
+ "BUG=chromium:234, , 123\n"
+ "R=somebody\n"))
+ self.assertEquals(" (issues 345, 456)\n",
+ MakeChangeLogBugReference("Title\n\n"
+ "\t\tBUG=v8:345,v8:456\n"
+ "R=somebody\n"))
+ self.assertEquals(" (issue 123, Chromium issues 345, 456)\n",
+ MakeChangeLogBugReference("Title\n\n"
+ "BUG=chromium:456\n"
+ "BUG = none\n"
+ "R=somebody\n"
+ "BUG=456,v8:123, 345"))
+
+ def testMakeChangeLogBugReferenceLong(self):
+ # -----------------00--------10--------20--------30--------
+ self.assertEquals(" (issues 234, 1234567890, 1234567"
+ "8901234567890, Chromium issues 12345678,\n"
+ " 123456789)\n",
+ MakeChangeLogBugReference("BUG=v8:234\n"
+ "BUG=v8:1234567890\n"
+ "BUG=v8:12345678901234567890\n"
+ "BUG=123456789\n"
+ "BUG=12345678\n"))
+ # -----------------00--------10--------20--------30--------
+ self.assertEquals(" (issues 234, 1234567890, 1234567"
+ "8901234567890, Chromium issues\n"
+ " 123456789, 1234567890)\n",
+ MakeChangeLogBugReference("BUG=v8:234\n"
+ "BUG=v8:12345678901234567890\n"
+ "BUG=v8:1234567890\n"
+ "BUG=123456789\n"
+ "BUG=1234567890\n"))
+ # -----------------00--------10--------20--------30--------
+ self.assertEquals(" (Chromium issues 234, 1234567890"
+ ", 12345678901234567,\n"
+ " 1234567890123456789)\n",
+ MakeChangeLogBugReference("BUG=234\n"
+ "BUG=12345678901234567\n"
+ "BUG=1234567890123456789\n"
+ "BUG=1234567890\n"))
+
class ScriptTest(unittest.TestCase):
def MakeEmptyTempFile(self):
handle, name = tempfile.mkstemp()
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698