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

Unified Diff: tools/web_dev_style/js_checker_test.py

Issue 2913453002: js_checker.py: Replace custom WrapperTypeCheck with ESLint's no-new-wrappers. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « tools/web_dev_style/js_checker.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/web_dev_style/js_checker_test.py
diff --git a/tools/web_dev_style/js_checker_test.py b/tools/web_dev_style/js_checker_test.py
index 428c78248865c7f0fe37de8913721115fb3b28ce..887ed603da49c2315bf43962937dfff24039fa11 100755
--- a/tools/web_dev_style/js_checker_test.py
+++ b/tools/web_dev_style/js_checker_test.py
@@ -267,50 +267,6 @@ class JsCheckerTest(SuperMoxTestBase):
for line in lines:
self.ShouldPassPolymerLocalIdCheck(line)
- def ShouldFailWrapperTypeCheck(self, line):
Dan Beam 2017/05/30 16:16:20 can we leave these? i know there's likely tests f
dpapad 2017/05/31 22:30:20 Added equivalent smoke tests in js_checker_eslint_
- """Checks that the use of wrapper types (i.e. new Number(), @type {Number})
- is a style error.
- """
- error = self.checker.WrapperTypeCheck(1, line)
- self.assertNotEqual('', error,
- msg='Should be flagged as style error: ' + line)
- highlight = test_util.GetHighlight(line, error)
- self.assertTrue(highlight in ('Boolean', 'Number', 'String'))
-
- def ShouldPassWrapperTypeCheck(self, line):
- """Checks that the wrapper type checker doesn't flag |line| as a style
- error.
- """
- self.assertEqual('', self.checker.WrapperTypeCheck(1, line),
- msg='Should not be flagged as style error: ' + line)
-
- def testWrapperTypePasses(self):
- lines = [
- "/** @param {!ComplexType} */",
- " * @type {Object}",
- " * @param {Function=} opt_callback",
- " * @param {} num Number of things to add to {blah}.",
- " * @return {!print_preview.PageNumberSet}",
- " /* @returns {Number} */", # Should be /** @return {Number} */
- "* @param {!LocalStrings}"
- " Your type of Boolean is false!",
- " Then I parameterized a Number from my friend!",
- " A String of Pearls",
- " types.params.aBoolean.typeString(someNumber)",
- ]
- for line in lines:
- self.ShouldPassWrapperTypeCheck(line)
-
- def testWrapperTypeFails(self):
- lines = [
- " /**@type {String}*/(string)",
- " * @param{Number=} opt_blah A number",
- "/** @private @return {!Boolean} */",
- " * @param {number|String}",
- ]
- for line in lines:
- self.ShouldFailWrapperTypeCheck(line)
-
def ShouldFailVarNameCheck(self, line):
"""Checks that var unix_hacker, $dollar are style errors."""
error = self.checker.VarNameCheck(1, line)
« no previous file with comments | « tools/web_dev_style/js_checker.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698