Index: chrome/browser/test_presubmit.py |
diff --git a/chrome/browser/test_presubmit.py b/chrome/browser/test_presubmit.py |
index 6c3a4d3061815bf4c9e06df533934950881e42ba..1f7e939199c08f713be9063acf8c8b465a4889e8 100755 |
--- a/chrome/browser/test_presubmit.py |
+++ b/chrome/browser/test_presubmit.py |
@@ -127,6 +127,39 @@ class JsStyleGuideTest(SuperMoxTestBase): |
for line in lines: |
self.ShouldPassChromeSendCheck(line) |
+ def ShouldFailEndJsDocCommentCheck(self, line): |
+ """Checks that the **/ checker flags |line| as a style error.""" |
+ error = self.checker.EndJsDocCommentCheck(1, line) |
+ self.assertNotEqual('', error, |
+ 'Should be flagged as style error: ' + line) |
+ self.assertEqual(self.GetHighlight(line, error), '**/') |
+ |
+ def ShouldPassEndJsDocCommentCheck(self, line): |
+ """Checks that the **/ checker doesn't flag |line| as a style error.""" |
+ self.assertEqual('', self.checker.EndJsDocCommentCheck(1, line), |
+ 'Should not be flagged as style error: ' + line) |
+ |
+ def testEndJsDocCommentFails(self): |
+ lines = [ |
+ "/** @override **/", |
+ "/** @type {number} @const **/", |
+ " **/", |
+ "**/ ", |
+ ] |
+ for line in lines: |
+ self.ShouldFailEndJsDocCommentCheck(line) |
+ |
+ def testEndJsDocCommentPasses(self): |
+ lines = [ |
+ "/***************/", # visual separators |
+ " */", # valid JSDoc comment ends |
+ "*/ ", |
+ "/**/", # funky multi-line comment enders |
+ "/** @override */", # legit JSDoc one-liners |
+ ] |
+ for line in lines: |
+ self.ShouldPassEndJsDocCommentCheck(line) |
+ |
def ShouldFailGetElementByIdCheck(self, line): |
"""Checks that the 'getElementById' checker flags |line| as a style |
error. |