Title: [278771] trunk/Tools
- Revision
- 278771
- Author
- jbed...@apple.com
- Date
- 2021-06-11 11:37:27 -0700 (Fri, 11 Jun 2021)
Log Message
[check-webkit-style] failing in JS checker due to python byte string
https://bugs.webkit.org/show_bug.cgi?id=226925
<rdar://problem/79166108>
Reviewed by Aakash Jain.
* Scripts/webkitpy/style/checkers/jstest.py:
(map_functions_to_dict): Use byte regexes.
(strip_trailing_blank_lines_and_comments): Ditto.
* Scripts/webkitpy/style/checkers/jstest_unittest.py:
(JSTestCheckerTestCase.test_map_functions_to_dict): Test content should be bytes.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (278770 => 278771)
--- trunk/Tools/ChangeLog 2021-06-11 18:36:22 UTC (rev 278770)
+++ trunk/Tools/ChangeLog 2021-06-11 18:37:27 UTC (rev 278771)
@@ -1,3 +1,17 @@
+2021-06-11 Jonathan Bedard <jbed...@apple.com>
+
+ [check-webkit-style] failing in JS checker due to python byte string
+ https://bugs.webkit.org/show_bug.cgi?id=226925
+ <rdar://problem/79166108>
+
+ Reviewed by Aakash Jain.
+
+ * Scripts/webkitpy/style/checkers/jstest.py:
+ (map_functions_to_dict): Use byte regexes.
+ (strip_trailing_blank_lines_and_comments): Ditto.
+ * Scripts/webkitpy/style/checkers/jstest_unittest.py:
+ (JSTestCheckerTestCase.test_map_functions_to_dict): Test content should be bytes.
+
2021-06-11 Truitt Savell <tsav...@apple.com>
Remove ews129 instead of ews179
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jstest.py (278770 => 278771)
--- trunk/Tools/Scripts/webkitpy/style/checkers/jstest.py 2021-06-11 18:36:22 UTC (rev 278770)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jstest.py 2021-06-11 18:37:27 UTC (rev 278771)
@@ -25,6 +25,7 @@
import re
+from webkitcorepy import string_utils
from webkitpy.common.system.systemhost import SystemHost
ALL_JS_TEST_FUNCTION_FILES = [
@@ -60,8 +61,8 @@
Args:
content: A multi-line string containing _javascript_ source to be split into individual function definitions.
"""
- functions = re.split(r'^function\s+', content, flags=re.MULTILINE)
- function_name_regex = re.compile(r'^(?P<name>\w+)\s*\(', flags=re.MULTILINE)
+ functions = re.split(br'^function\s+', content, flags=re.MULTILINE)
+ function_name_regex = re.compile(br'^(?P<name>\w+)\s*\(', flags=re.MULTILINE)
result = {}
for f in functions:
match = function_name_regex.match(f)
@@ -77,11 +78,11 @@
function: A multi-line string representing the source for one _javascript_ function, less the "function" keyword.
"""
lines = function.splitlines(True)
- blank_line_regex = re.compile(r'^\s*$')
- comment_line_regex = re.compile(r'^\s*//.*$')
+ blank_line_regex = re.compile(br'^\s*$')
+ comment_line_regex = re.compile(br'^\s*//.*$')
while blank_line_regex.search(lines[-1]) or comment_line_regex.search(lines[-1]):
del lines[-1]
- return ''.join(lines)
+ return b''.join(lines)
class JSTestChecker(object):
@@ -136,5 +137,5 @@
if function_name in baseline_function_map.keys() and function_name in test_function_map.keys():
if baseline_function_map[function_name] != test_function_map[function_name]:
error_message = "Changes to function {0}() should be kept in sync with {1}.".format(
- function_name, path)
+ string_utils.decode(function_name), path)
self._handle_style_error(0, 'jstest/function_equality', 5, error_message)
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jstest_unittest.py (278770 => 278771)
--- trunk/Tools/Scripts/webkitpy/style/checkers/jstest_unittest.py 2021-06-11 18:36:22 UTC (rev 278770)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jstest_unittest.py 2021-06-11 18:37:27 UTC (rev 278771)
@@ -36,7 +36,7 @@
This also implicitly tests strip_trailing_blank_lines_and_comments().
"""
- file1 = """
+ file1 = b"""
function shouldBe() {}
// Same as !shouldBe(), but output makes more sense.
@@ -53,7 +53,7 @@
"""
result1 = map_functions_to_dict(file1)
- file2 = """function shouldBe() {}
+ file2 = b"""function shouldBe() {}
function shouldNotBe() {}
function shouldThrow() {
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes