mirror of
https://github.com/servo/servo.git
synced 2025-09-14 08:58:21 +01:00
Update web-platform-tests to revision 592e2ed83ecd717392d37047536250ba74f1bafa
This commit is contained in:
parent
c8b0dc965d
commit
0a3e19aac8
65 changed files with 1906 additions and 106 deletions
|
@ -87,7 +87,8 @@ class HTMLItem(pytest.Item, pytest.Collector):
|
|||
|
||||
@staticmethod
|
||||
def _assert_sequence(nums):
|
||||
assert nums == range(1, nums[-1] + 1)
|
||||
if nums and len(nums) > 0:
|
||||
assert nums == range(1, nums[-1] + 1)
|
||||
|
||||
@staticmethod
|
||||
def _scrub_stack(test_obj):
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>idlharness: partial dictionaries</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<script src="../helper.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<pre id='idl'>
|
||||
dictionary A {};
|
||||
partial dictionary A {
|
||||
boolean B;
|
||||
};
|
||||
partial dictionary A {
|
||||
boolean C;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(() => {
|
||||
let idlArray = new IdlArray();
|
||||
idlArray.add_idls(document.getElementById('idl').textContent);
|
||||
idlArray.test();
|
||||
|
||||
let members = idlArray.members["A"].members.map(m => m.name);
|
||||
assert_array_equals(members, ["B", "C"], 'A should contain B, C');
|
||||
}, 'Partial dictionaries');
|
||||
|
||||
test(() => {
|
||||
let idlArray = new IdlArray();
|
||||
idlArray.add_idls('partial dictionary D {};');
|
||||
idlArray.assert_throws('Partial dictionary D with no original dictionary', i => i.test());
|
||||
}, 'Partial-only dictionary definition')
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -29,6 +29,27 @@
|
|||
test(function() {
|
||||
assert_equals(typeof WebIDL2.parse("interface Foo {};"), "object");
|
||||
}, 'WebIDL2 parse method should produce an AST for correct WebIDL');
|
||||
for (let type of ['dictionary', 'interface']) {
|
||||
test(function() {
|
||||
let i = new IdlArray();
|
||||
i.add_untested_idls(`partial ${type} A {};`);
|
||||
i.assert_throws(new IdlHarnessError(`Partial ${type} A with no original ${type}`), i => i.test());
|
||||
}, `assert_throws should handle ${type} IdlHarnessError`);
|
||||
test(function() {
|
||||
let i = new IdlArray();
|
||||
i.add_untested_idls(`partial ${type} A {};`);
|
||||
i.assert_throws(`Partial ${type} A with no original ${type}`, i => i.test());
|
||||
}, `assert_throws should handle ${type} IdlHarnessError from message`);
|
||||
test(function () {
|
||||
try {
|
||||
let i = new IdlArray();
|
||||
i.add_untested_idls(`${type} A {};`);
|
||||
i.assert_throws(`Partial ${type} A with no original ${type}`, i => i.test());
|
||||
} catch (e) {
|
||||
assert_true(e instanceof IdlHarnessError);
|
||||
}
|
||||
}, `assert_throws should throw if no ${type} IdlHarnessError thrown`);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue