Commit e085d81a authored by maruel@chromium.org's avatar maruel@chromium.org

Add assert to make sure the files argument type is valid.

This would have caught a bug in the CQ instead of silently failing.

R=dpranke@chromium.org
BUG=
TEST=


Review URL: http://codereview.chromium.org/8203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@104767 0039d316-1c4b-4281-b951-d872f2087c98
parent 51f44f4c
......@@ -690,6 +690,9 @@ class Change(object):
self._description_without_tags = (
'\n'.join(description_without_tags).rstrip())
assert all(
(isinstance(f, (list, tuple)) and len(f) == 2) for f in files), files
self._affected_files = [
self._AFFECTED_FILES(info[1], info[0].strip(), self._local_root)
for info in files
......
......@@ -351,6 +351,20 @@ class PresubmitUnittest(PresubmitTestsBase):
self.assertEquals(rhs_lines[13][1], 49)
self.assertEquals(rhs_lines[13][2], 'this is line number 48.1')
def testInvalidChange(self):
try:
presubmit.SvnChange(
'mychange',
'description',
self.fake_root_dir,
['foo/blat.cc', 'bar'],
0,
0,
None)
self.fail()
except AssertionError:
pass
def testExecPresubmitScript(self):
description_lines = ('Hello there',
'this is a change',
......@@ -770,7 +784,7 @@ def CheckChangeOnCommit(input_api, output_api):
self.mox.StubOutWithMock(presubmit, 'ParseFiles')
presubmit.scm.determine_scm(self.fake_root_dir).AndReturn(None)
presubmit.ParseFiles(['random_file.txt'], None
).AndReturn(['random_file.txt'])
).AndReturn([('M', 'random_file.txt')])
output = self.mox.CreateMock(presubmit.PresubmitOutput)
output.should_continue().AndReturn(False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment