mirror of
https://github.com/servo/servo.git
synced 2025-08-14 09:55:35 +01:00
Update web-platform-tests to revision cfada7e6cb379699fa94c7ed8fcb97082327e10c
This commit is contained in:
parent
87e7e3d429
commit
06b00da16b
179 changed files with 6103 additions and 1186 deletions
|
@ -48,6 +48,15 @@ def replace_end(s, old, new):
|
|||
return s[:-len(old)] + new
|
||||
|
||||
|
||||
def domains_are_distinct(a, b):
|
||||
a_parts = a.split(".")
|
||||
b_parts = b.split(".")
|
||||
min_length = min(len(a_parts), len(b_parts))
|
||||
slice_index = -1 * min_length
|
||||
|
||||
return a_parts[slice_index:] != b_parts[slice_index:]
|
||||
|
||||
|
||||
class WrapperHandler(object):
|
||||
|
||||
__meta__ = abc.ABCMeta
|
||||
|
@ -798,6 +807,14 @@ class ConfigBuilder(config.ConfigBuilder):
|
|||
*args,
|
||||
**kwargs
|
||||
)
|
||||
with self as c:
|
||||
browser_host = c.get("browser_host")
|
||||
alternate_host = c.get("alternate_hosts", {}).get("alt")
|
||||
|
||||
if not domains_are_distinct(browser_host, alternate_host):
|
||||
raise ValueError(
|
||||
"Alternate host must be distinct from browser host"
|
||||
)
|
||||
|
||||
def _get_ws_doc_root(self, data):
|
||||
if data["ws_doc_root"] is not None:
|
||||
|
|
|
@ -84,3 +84,24 @@ def test_config_json_length():
|
|||
with ConfigBuilder() as c:
|
||||
data = json.dumps(c.as_dict())
|
||||
assert len(data) <= 0x7FFF
|
||||
|
||||
def test_alternate_host_unspecified():
|
||||
ConfigBuilder(browser_host="web-platform.test")
|
||||
|
||||
@pytest.mark.parametrize("primary, alternate", [
|
||||
("web-platform.test", "web-platform.test"),
|
||||
("a.web-platform.test", "web-platform.test"),
|
||||
("web-platform.test", "a.web-platform.test"),
|
||||
("a.web-platform.test", "a.web-platform.test"),
|
||||
])
|
||||
def test_alternate_host_invalid(primary, alternate):
|
||||
with pytest.raises(ValueError):
|
||||
ConfigBuilder(browser_host=primary, alternate_hosts={"alt": alternate})
|
||||
|
||||
@pytest.mark.parametrize("primary, alternate", [
|
||||
("web-platform.test", "not-web-platform.test"),
|
||||
("a.web-platform.test", "b.web-platform.test"),
|
||||
("web-platform-tests.dev", "web-platform-tests.live"),
|
||||
])
|
||||
def test_alternate_host_valid(primary, alternate):
|
||||
ConfigBuilder(browser_host=primary, alternate_hosts={"alt": alternate})
|
||||
|
|
|
@ -58,7 +58,8 @@ class DataNode(Node):
|
|||
while index > 0 and isinstance(self.children[index - 1], DataNode):
|
||||
index -= 1
|
||||
for i in xrange(index):
|
||||
assert other.data != self.children[i].data
|
||||
if other.data == self.children[i].data:
|
||||
raise ValueError("Duplicate key %s" % self.children[i].data)
|
||||
self.children.insert(index, other)
|
||||
|
||||
|
||||
|
|
|
@ -520,11 +520,18 @@ class Parser(object):
|
|||
self.expr_builders = []
|
||||
|
||||
def parse(self, input):
|
||||
self.reset()
|
||||
self.token_generator = self.tokenizer.tokenize(input)
|
||||
self.consume()
|
||||
self.manifest()
|
||||
return self.tree.node
|
||||
try:
|
||||
self.reset()
|
||||
self.token_generator = self.tokenizer.tokenize(input)
|
||||
self.consume()
|
||||
self.manifest()
|
||||
return self.tree.node
|
||||
except Exception as e:
|
||||
if not isinstance(e, ParseError):
|
||||
raise ParseError(self.tokenizer.filename,
|
||||
self.tokenizer.line_number,
|
||||
str(e))
|
||||
raise
|
||||
|
||||
def consume(self):
|
||||
self.token = self.token_generator.next()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue