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

Unified Diff: PRESUBMIT_test.py

Issue 2576253002: ES6 Style: add presubmit prompt about => in code that might run on iOS9 (Closed)
Patch Set: Created 4 years 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 | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT_test.py
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index e5f6215224c6e17fb49bf18294b57ca9af34d5b2..34da837503ee43af54f882c1b709baaff0b4ce00 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -412,16 +412,16 @@ class CheckSingletonInHeadersTest(unittest.TestCase):
self.assertEqual(0, len(warnings))
-class CheckNoDeprecatedCompiledResourcesGYPTest(unittest.TestCase):
- def testNoDeprecatedCompiledResourcsGYP(self):
+class CheckNoDeprecatedCompiledResourcesGypTest(unittest.TestCase):
+ def testNoDeprecatedCompiledResourcsGyp(self):
mock_input_api = MockInputApi()
mock_input_api.files = [MockFile('some/js/compiled_resources.gyp', [])]
- errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGYP(mock_input_api,
+ errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGyp(mock_input_api,
MockOutputApi())
self.assertEquals(1, len(errors))
mock_input_api.files = [MockFile('some/js/compiled_resources2.gyp', [])]
- errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGYP(mock_input_api,
+ errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGyp(mock_input_api,
MockOutputApi())
self.assertEquals(0, len(errors))
@@ -1188,5 +1188,41 @@ class ForwardDeclarationTest(unittest.TestCase):
self.assertEqual(4, len(warnings))
+class RiskyJsTest(unittest.TestCase):
+ def testArrowWarnInIos9Code(self):
+ mock_input_api = MockInputApi()
+ mock_output_api = MockOutputApi()
+
+ mock_input_api.files = [
+ MockAffectedFile('components/blah.js', ["shouldn't use => here"]),
+ ]
+ warnings = PRESUBMIT._CheckForRiskyJsFeatures(
+ mock_input_api, mock_output_api)
+ self.assertEqual(1, len(warnings))
+
+ mock_input_api.files = [
+ MockAffectedFile('ios/blee.js', ['might => break folks']),
+ ]
+ warnings = PRESUBMIT._CheckForRiskyJsFeatures(
+ mock_input_api, mock_output_api)
+ self.assertEqual(1, len(warnings))
+
+ mock_input_api.files = [
+ MockAffectedFile('ui/webui/resources/blarg.js', ['on => iOS9']),
+ ]
+ warnings = PRESUBMIT._CheckForRiskyJsFeatures(
+ mock_input_api, mock_output_api)
+ self.assertEqual(1, len(warnings))
+
+ def testArrowsAllowedInChromeCode(self):
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockAffectedFile('chrome/browser/resources/blah.js', 'arrow => OK here'),
+ ]
+ warnings = PRESUBMIT._CheckForRiskyJsFeatures(
+ mock_input_api, MockOutputApi())
+ self.assertEqual(0, len(warnings))
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698