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

Unified Diff: PRESUBMIT_test.py

Issue 11417044: Adds a presubmit that looks for version control conflicts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding line contents Created 8 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 | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT_test.py
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 413345840a50b47d7410abee87d9d9d11e84b02b..80c17567587099720a85849675a168ba72b9de5a 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -20,6 +20,10 @@ class MockFile(object):
def __init__(self, local_path, new_contents):
self._local_path = local_path
self._new_contents = new_contents
+ self._changed_contents = [(i + 1, l) for i, l in enumerate(new_contents)]
+
+ def ChangedContents(self):
+ return self._changed_contents
def NewContents(self):
return self._new_contents
@@ -172,5 +176,20 @@ class IncludeOrderTest(unittest.TestCase):
self.assertEqual(0, len(warnings))
+class VersionControlerConflictsTest(unittest.TestCase):
+ def testTypicalConflict(self):
+ lines = ['<<<<<<< HEAD',
+ ' base::ScopedTempDir temp_dir_;',
+ '=======',
+ ' ScopedTempDir temp_dir_;',
+ '>>>>>>> master']
+ errors = PRESUBMIT._CheckForVersionControlConflictsInFile(
+ MockInputApi(), MockFile('some/path/foo_platform.cc', lines))
+ self.assertEqual(3, len(errors))
+ self.assertTrue('1' in errors[0])
+ self.assertTrue('3' in errors[1])
+ self.assertTrue('5' in errors[2])
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698