mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision bc60e6f82132cfc9a5b688c566c7772024b3c15c
This commit is contained in:
parent
449881f566
commit
29156ca9e2
223 changed files with 7517 additions and 2093 deletions
|
@ -3,10 +3,10 @@ from __future__ import print_function
|
|||
import os, sys, json, re
|
||||
|
||||
script_directory = os.path.dirname(os.path.abspath(__file__))
|
||||
template_directory = os.path.abspath(os.path.join(script_directory,
|
||||
'template'))
|
||||
test_root_directory = os.path.abspath(os.path.join(script_directory,
|
||||
'..', '..', '..'))
|
||||
template_directory = os.path.abspath(
|
||||
os.path.join(script_directory, 'template'))
|
||||
test_root_directory = os.path.abspath(
|
||||
os.path.join(script_directory, '..', '..', '..'))
|
||||
|
||||
|
||||
def get_template(basename):
|
||||
|
@ -20,22 +20,22 @@ def write_file(filename, contents):
|
|||
|
||||
|
||||
def read_nth_line(fp, line_number):
|
||||
fp.seek(0)
|
||||
for i, line in enumerate(fp):
|
||||
if (i + 1) == line_number:
|
||||
return line
|
||||
fp.seek(0)
|
||||
for i, line in enumerate(fp):
|
||||
if (i + 1) == line_number:
|
||||
return line
|
||||
|
||||
|
||||
def load_spec_json(path_to_spec):
|
||||
re_error_location = re.compile('line ([0-9]+) column ([0-9]+)')
|
||||
with open(path_to_spec, "r") as f:
|
||||
try:
|
||||
return json.load(f)
|
||||
return json.load(f)
|
||||
except ValueError as ex:
|
||||
print(ex.message)
|
||||
match = re_error_location.search(ex.message)
|
||||
if match:
|
||||
line_number, column = int(match.group(1)), int(match.group(2))
|
||||
print(read_nth_line(f, line_number).rstrip())
|
||||
print(" " * (column - 1) + "^")
|
||||
sys.exit(1)
|
||||
print(ex.message)
|
||||
match = re_error_location.search(ex.message)
|
||||
if match:
|
||||
line_number, column = int(match.group(1)), int(match.group(2))
|
||||
print(read_nth_line(f, line_number).rstrip())
|
||||
print(" " * (column - 1) + "^")
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue