| Index: tests/presubmit_unittest.py
|
| diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
|
| index 8753dc7249e91a0867cb3a2619ce2921d7997663..9a9ce450e8c473fd711416b6bb63a5641308302b 100755
|
| --- a/tests/presubmit_unittest.py
|
| +++ b/tests/presubmit_unittest.py
|
| @@ -1457,27 +1457,38 @@ class CannedChecksUnittest(PresubmitTestsBase):
|
| def testMembersChanged(self):
|
| self.mox.ReplayAll()
|
| members = [
|
| - 'CheckBuildbotPendingBuilds',
|
| - 'CheckChangeHasBugField', 'CheckChangeHasDescription',
|
| - 'CheckChangeHasNoStrayWhitespace',
|
| - 'CheckChangeHasOnlyOneEol', 'CheckChangeHasNoCR',
|
| - 'CheckChangeHasNoCrAndHasOnlyOneEol', 'CheckChangeHasNoTabs',
|
| - 'CheckChangeTodoHasOwner',
|
| - 'CheckChangeHasQaField', 'CheckChangeHasTestedField',
|
| - 'CheckChangeHasTestField',
|
| - 'CheckChangeLintsClean',
|
| - 'CheckChangeSvnEolStyle',
|
| - 'CheckChangeWasUploaded',
|
| - 'CheckDoNotSubmit',
|
| - 'CheckDoNotSubmitInDescription', 'CheckDoNotSubmitInFiles',
|
| - 'CheckLongLines', 'CheckTreeIsOpen', 'PanProjectChecks',
|
| - 'CheckLicense',
|
| - 'CheckOwners',
|
| - 'CheckRietveldTryJobExecution',
|
| - 'CheckSvnModifiedDirectories',
|
| - 'CheckSvnForCommonMimeTypes', 'CheckSvnProperty',
|
| - 'RunPythonUnitTests', 'RunPylint',
|
| - 'RunUnitTests', 'RunUnitTestsInDirectory',
|
| + 'CheckBuildbotPendingBuilds',
|
| + 'CheckChangeHasBugField',
|
| + 'CheckChangeHasDescription',
|
| + 'CheckChangeHasNoCR',
|
| + 'CheckChangeHasNoCrAndHasOnlyOneEol',
|
| + 'CheckChangeHasNoStrayWhitespace',
|
| + 'CheckChangeHasNoTabs',
|
| + 'CheckChangeHasOnlyOneEol',
|
| + 'CheckChangeHasQaField',
|
| + 'CheckChangeHasTestedField',
|
| + 'CheckChangeHasTestField',
|
| + 'CheckChangeLintsClean',
|
| + 'CheckChangeSvnEolStyle',
|
| + 'CheckChangeTodoHasOwner',
|
| + 'CheckChangeWasUploaded',
|
| + 'CheckDoNotSubmit',
|
| + 'CheckDoNotSubmitInDescription',
|
| + 'CheckDoNotSubmitInFiles',
|
| + 'CheckLicense',
|
| + 'CheckLongLines', 'CheckTreeIsOpen',
|
| + 'CheckOwners',
|
| + 'CheckRietveldTryJobExecution',
|
| + 'CheckSvnForCommonMimeTypes',
|
| + 'CheckSvnModifiedDirectories',
|
| + 'CheckSvnProperty',
|
| + 'CheckWebDevStyleGuide',
|
| + 'PanProjectChecks',
|
| + 're',
|
| + 'RunPylint',
|
| + 'RunPythonUnitTests',
|
| + 'RunUnitTests',
|
| + 'RunUnitTestsInDirectory',
|
| ]
|
| # If this test fails, you should add the relevant test.
|
| self.compareMembers(presubmit_canned_checks, members)
|
| @@ -2286,6 +2297,44 @@ class CannedChecksUnittest(PresubmitTestsBase):
|
| 'Found line ending with white spaces in:', results[0]._message)
|
| self.checkstdout('')
|
|
|
| + def testCheckWebDevStyleGuide(self):
|
| + fake_file = 'fake.css'
|
| + fake_contents = """
|
| +/* Comment */
|
| +.badClass, #anotherSelector {
|
| + color:hsl(0, 5, 0%) #777777;
|
| + background: #369 0px 10px; /* comment */ }
|
| +
|
| +@media print /*
|
| + Comment.
|
| + */
|
| +{
|
| + @-webkit-keyframe {
|
| + 0% {
|
| + blah: blah;
|
| + }
|
| + 0%{blar: blug;}
|
| + }
|
| +} /** comment **/
|
| +
|
| +.app-contents:active:not(.suppress-active),
|
| +.app:not(.click-focus):focus .app-contents:not(.suppress-active),
|
| +html[dir="rtl"] .drag-representation:not(.placing) .app-contents {
|
| + border-radius: 10px;
|
| + -webkit-border-radius: 5px;
|
| +}"""
|
| +
|
| + change = presubmit.Change('fu', 'bar', self.fake_root_dir, None, 0, 0, None)
|
| + input_api = self.MockInputApi(change, False)
|
| + input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([fake_file])
|
| + input_api.ReadFile(fake_file).MultipleTimes().AndReturn(fake_contents)
|
| +
|
| + self.mox.ReplayAll()
|
| +
|
| + output = presubmit_canned_checks._CheckWebDevStyleGuide(
|
| + input_api, presubmit.OutputApi, None)
|
| +
|
| + print "%s" % output
|
|
|
| if __name__ == '__main__':
|
| import unittest
|
|
|