Update iOS JavaScript presubmit to support moved files
The presubmit currently prevents moving a JavaScript file to a new
location. This CL allows such CLs by using a warning instead of an error
if a script of the same name was deleted and added in the examined diff.
Change-Id: I0c5761b5f774bea8a6733e78c2ef0a31d47eab9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335695
Reviewed-by: Dominic Battré <battre@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1117004}
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index 297e6b3..bb48309 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -4915,6 +4915,17 @@
self.assertEqual('warning', results[0].type)
self.assertEqual(1, len(results[0].items))
+ def testMovedScriptWarningOnly(self):
+ input_api = MockInputApi()
+ input_api.files = [
+ MockFile('ios/chrome/feature/resources/script.js', [], action='D'),
+ MockFile('ios/chrome/renamed_feature/resources/script.js', [], action='A'),
+ ]
+ results = PRESUBMIT.CheckNoJsInIos(input_api, MockOutputApi())
+ self.assertEqual(1, len(results))
+ self.assertEqual('warning', results[0].type)
+ self.assertEqual(1, len(results[0].items))
+
class CheckNoAbbreviationInPngFileNameTest(unittest.TestCase):
def testHasAbbreviation(self):
"""test png file names with abbreviation that fails the check"""