summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT_test.py
diff options
context:
space:
mode:
authordbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-20 03:45:03 +0000
committerdbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-20 03:45:03 +0000
commit70ca7775fe7edbe3973e3507c6ca00d26e4df5dc (patch)
treedc03834235c802d64b9a0beb4d9e0373f8f402ad /PRESUBMIT_test.py
parent2ba8d10b3ee068b2c29550a7976b593abc0a090a (diff)
downloadchromium_src-70ca7775fe7edbe3973e3507c6ca00d26e4df5dc.zip
chromium_src-70ca7775fe7edbe3973e3507c6ca00d26e4df5dc.tar.gz
chromium_src-70ca7775fe7edbe3973e3507c6ca00d26e4df5dc.tar.bz2
Adds a presubmit that looks for version control conflicts.
R=maruel@chromium.org,thakis@chromium.org BUG=None Review URL: https://chromiumcodereview.appspot.com/11417044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT_test.py')
-rwxr-xr-xPRESUBMIT_test.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 4133458..80c1756 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()