Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9999)

Unified Diff: chrome/browser/test_presubmit.py

Issue 251713002: web_dev_style: add check for ending jsdoc comments with **/ instead of */. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « no previous file | chrome/browser/web_dev_style/js_checker.py » ('j') | chrome/browser/web_dev_style/js_checker.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698