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 ce90192dc19ac5fd572e6b826b9c0c4dae59f70e..5f3c0e6fd199c9c2de14344b542e132d2a4c6661 100644 |
--- a/tools/push-to-trunk/test_scripts.py |
+++ b/tools/push-to-trunk/test_scripts.py |
@@ -543,16 +543,10 @@ class ScriptTest(unittest.TestCase): |
cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE]) |
self.assertEquals(cl_chunk, cl) |
- def testSquashCommits(self): |
+ def _TestSquashCommits(self, change_log, expected_msg): |
TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f: |
- f.write("1999-11-11: Version 3.22.5\n") |
- f.write("\n") |
- f.write(" Log text 1.\n") |
- f.write(" Chromium issue 12345\n") |
- f.write("\n") |
- f.write(" Performance and stability improvements on all " |
- "platforms.\n") |
+ f.write(change_log) |
self.ExpectGit([ |
["diff svn/trunk hash1", "patch content"], |
@@ -562,16 +556,44 @@ class ScriptTest(unittest.TestCase): |
self.MakeStep().Persist("date", "1999-11-11") |
self.MakeStep(SquashCommits).Run() |
- |
- msg = FileToText(TEST_CONFIG[COMMITMSG_FILE]) |
- self.assertTrue(re.search(r"Version 3\.22\.5", msg)) |
- self.assertTrue(re.search(r"Performance and stability", msg)) |
- self.assertTrue(re.search(r"Log text 1\. Chromium issue 12345", msg)) |
- self.assertFalse(re.search(r"\d+\-\d+\-\d+", msg)) |
+ self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) |
patch = FileToText(TEST_CONFIG[ PATCH_FILE]) |
self.assertTrue(re.search(r"patch content", patch)) |
+ def testSquashCommitsUnformatted(self): |
+ change_log = """1999-11-11: Version 3.22.5 |
+ |
+ Log text 1. |
+ Chromium issue 12345 |
+ |
+ Performance and stability improvements on all platforms.\n""" |
+ commit_msg = """Version 3.22.5 |
+ |
+Log text 1. Chromium issue 12345 |
+ |
+Performance and stability improvements on all platforms.""" |
+ self._TestSquashCommits(change_log, commit_msg) |
+ |
+ def testSquashCommitsFormatted(self): |
+ change_log = """1999-11-11: Version 3.22.5 |
+ |
+ Long commit message that fills more than 80 characters (Chromium issue |
+ 12345). |
+ |
+ Performance and stability improvements on all platforms.\n""" |
+ commit_msg = """Version 3.22.5 |
+ |
+Long commit message that fills more than 80 characters (Chromium issue 12345). |
+ |
+Performance and stability improvements on all platforms.""" |
+ self._TestSquashCommits(change_log, commit_msg) |
+ |
+ def testSquashCommitsQuotationMarks(self): |
+ change_log = """Line with "quotation marks".\n""" |
+ commit_msg = """Line with "quotation marks".""" |
+ self._TestSquashCommits(change_log, commit_msg) |
+ |
def _PushToTrunk(self, force=False, manual=False): |
TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |