Update web-platform-tests to revision 50d6ee076e94273080d9f3b69be0bf4eeae156d3

This commit is contained in:
WPT Sync Bot 2018-08-22 21:45:47 -04:00
parent 3b9055510a
commit 280c87822d
331 changed files with 4209 additions and 866 deletions

View file

@ -25,6 +25,14 @@ test_0 = """\
tags: [a, @Reset]
"""
test_1 = """\
[1.html]
prefs:
if os == 'win': [a:b, c:d]
expected:
if os == 'win': FAIL
"""
def test_metadata_inherit():
tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10),
@ -48,3 +56,19 @@ def test_metadata_inherit():
assert test_obj.min_assertion_count == 1
assert test_obj.prefs == {"b": "c", "c": "d"}
assert test_obj.tags == {"a", "dir:a"}
def test_conditional():
tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10),
("test", "c", 10))
test_metadata = manifestexpected.static.compile(BytesIO(test_1),
{"os": "win"},
data_cls_getter=manifestexpected.data_cls_getter,
test_path="a",
url_base="")
test = tests[1][2].pop()
test_obj = wpttest.from_manifest(test, [], test_metadata.get_test(test.id))
assert test_obj.prefs == {"a": "b", "c": "d"}
assert test_obj.expected() == "FAIL"

View file

@ -212,6 +212,20 @@ class Tokenizer(object):
else:
self.state = self.value_state
def after_expr_state(self):
self.skip_whitespace()
c = self.char()
if c == "#":
self.next_state = self.after_expr_state
self.state = self.comment_state
elif c == eol:
self.next_state = self.after_expr_state
self.state = self.eol_state
elif c == "[":
self.state = self.list_start_state
else:
self.state = self.value_state
def list_start_state(self):
yield (token_types.list_start, "[")
self.consume()
@ -378,7 +392,7 @@ class Tokenizer(object):
elif c == ":":
yield (token_types.separator, c)
self.consume()
self.state = self.value_state
self.state = self.after_expr_state
elif c in parens:
self.consume()
yield (token_types.paren, c)
@ -586,10 +600,7 @@ class Parser(object):
self.tree.append(ConditionalNode())
self.expr_start()
self.expect(token_types.separator)
if self.token[0] == token_types.string:
self.value()
else:
raise ParseError
self.value_block()
self.tree.pop()
def value(self):

View file

@ -63,6 +63,42 @@ key:
]]]]]]
)
def test_expr_2(self):
self.compare(
"""
key:
if x == 1 : [value1, value2]""",
["DataNode", None,
[["KeyValueNode", "key",
[["ConditionalNode", None,
[["BinaryExpressionNode", None,
[["BinaryOperatorNode", "==", []],
["VariableNode", "x", []],
["NumberNode", "1", []]
]],
["ListNode", None,
[["ValueNode", "value1", []],
["ValueNode", "value2", []]]],
]]]]]]
)
def test_expr_3(self):
self.compare(
"""
key:
if x == 1: if b: value""",
["DataNode", None,
[["KeyValueNode", "key",
[["ConditionalNode", None,
[["BinaryExpressionNode", None,
[["BinaryOperatorNode", "==", []],
["VariableNode", "x", []],
["NumberNode", "1", []]
]],
["ValueNode", "if b: value", []],
]]]]]]
)
def test_atom_0(self):
with self.assertRaises(parser.ParseError):
self.parse("key: @Unknown")
@ -71,5 +107,6 @@ key:
with self.assertRaises(parser.ParseError):
self.parse("key: @true")
if __name__ == "__main__":
unittest.main()

View file

@ -223,3 +223,8 @@ class TokenizerTest(unittest.TestCase):
def test_atom_4(self):
self.compare(r"""key: [a, @Reset, b]
""")
def test_conditional_1(self):
self.compare("""foo:
if a or b: [1, 2]
""")

View file

@ -163,6 +163,7 @@ def run_tests(config, test_paths, product, **kwargs):
logger.info("Using %i client processes" % kwargs["processes"])
skipped_tests = 0
test_total = 0
unexpected_total = 0
@ -234,6 +235,7 @@ def run_tests(config, test_paths, product, **kwargs):
for test in test_loader.disabled_tests[test_type]:
logger.test_start(test.id)
logger.test_end(test.id, status="SKIP")
skipped_tests += 1
if test_type == "testharness":
run_tests = {"testharness": []}
@ -242,6 +244,7 @@ def run_tests(config, test_paths, product, **kwargs):
test.jsshell and not executor_cls.supports_jsshell):
logger.test_start(test.id)
logger.test_end(test.id, status="SKIP")
skipped_tests += 1
else:
run_tests["testharness"].append(test)
else:
@ -277,8 +280,11 @@ def run_tests(config, test_paths, product, **kwargs):
logger.suite_end()
if test_total == 0:
logger.error("No tests ran")
return False
if skipped_tests > 0:
logger.warning("All requested tests were skipped")
else:
logger.error("No tests ran")
return False
if unexpected_total and not kwargs["fail_on_unexpected"]:
logger.info("Tolerating %s unexpected results" % unexpected_total)
@ -314,7 +320,7 @@ def start(**kwargs):
elif kwargs["list_tests"]:
list_tests(**kwargs)
elif kwargs["verify"] or kwargs["stability"]:
check_stability(**kwargs)
return check_stability(**kwargs)
else:
return not run_tests(**kwargs)