| Index: tests/presubmit_unittest.py
|
| diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
|
| index f0ea1d587a143a878fea8856c98c5742f8b8de88..25e484bafeb535edab70f4d3130ef8e52b593831 100755
|
| --- a/tests/presubmit_unittest.py
|
| +++ b/tests/presubmit_unittest.py
|
| @@ -831,6 +831,7 @@ class AffectedFileUnittest(PresubmitTestsBase):
|
| members = [
|
| 'AbsoluteLocalPath', 'Action', 'IsDirectory', 'IsTextFile', 'LocalPath',
|
| 'NewContents', 'OldContents', 'OldFileTempPath', 'Property', 'ServerPath',
|
| + 'scm',
|
| ]
|
| # If this test fails, you should add the relevant test.
|
| self.compareMembers(presubmit.AffectedFile('a', 'b'), members)
|
| @@ -936,7 +937,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
|
| members = [
|
| 'CheckChangeHasBugField', 'CheckChangeHasNoCR', 'CheckChangeHasNoTabs',
|
| 'CheckChangeHasQaField', 'CheckChangeHasTestedField',
|
| - 'CheckChangeHasTestField', 'CheckDoNotSubmit',
|
| + 'CheckChangeHasTestField', 'CheckChangeSvnEolStyle',
|
| + 'CheckDoNotSubmit',
|
| 'CheckDoNotSubmitInDescription', 'CheckDoNotSubmitInFiles',
|
| 'CheckLongLines', 'CheckTreeIsOpen', 'RunPythonUnitTests',
|
| ]
|
| @@ -1049,6 +1051,38 @@ class CannedChecksUnittest(PresubmitTestsBase):
|
| self.TestContent(check, '', 'blah blah blah',
|
| presubmit.OutputApi.PresubmitPromptWarning)
|
|
|
| +
|
| + def testCheckChangeSvnEolStyle(self):
|
| + input_api1 = self.MockInputApi()
|
| + files1 = [
|
| + presubmit.SvnAffectedFile('foo/bar.cc', 'A'),
|
| + presubmit.SvnAffectedFile('foo.cc', 'M'),
|
| + ]
|
| + input_api1.AffectedSourceFiles(None).AndReturn(files1)
|
| + presubmit.gcl.GetSVNFileProperty(presubmit.normpath('foo/bar.cc'),
|
| + 'svn:eol-style').AndReturn('LF')
|
| + presubmit.gcl.GetSVNFileProperty(presubmit.normpath('foo.cc'),
|
| + 'svn:eol-style').AndReturn('LF')
|
| + input_api2 = self.MockInputApi()
|
| + files2 = [
|
| + presubmit.SvnAffectedFile('foo/bar.cc', 'A'),
|
| + presubmit.SvnAffectedFile('foo.cc', 'M'),
|
| + ]
|
| + input_api2.AffectedSourceFiles(None).AndReturn(files2)
|
| + presubmit.gcl.GetSVNFileProperty(presubmit.normpath('foo/bar.cc'),
|
| + 'svn:eol-style').AndReturn('native')
|
| + presubmit.gcl.GetSVNFileProperty(presubmit.normpath('foo.cc'),
|
| + 'svn:eol-style').AndReturn('CRLF')
|
| + self.mox.ReplayAll()
|
| +
|
| + results1 = presubmit_canned_checks.CheckChangeSvnEolStyle(
|
| + input_api1, presubmit.OutputApi, None)
|
| + self.assertEquals(results1, [])
|
| + results2 = presubmit_canned_checks.CheckChangeSvnEolStyle(
|
| + input_api2, presubmit.OutputApi, None)
|
| + self.assertEquals(len(results2), 1)
|
| + self.assertEquals(results2[0].__class__, presubmit.OutputApi.PresubmitError)
|
| +
|
| def testCannedCheckTreeIsOpenOpen(self):
|
| input_api = self.MockInputApi()
|
| input_api.is_committing = True
|
|
|