mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update web-platform-tests to revision bf71b1f245ce34e447b7bde8ed46694574a63da7
This commit is contained in:
parent
7256d123ff
commit
e17a773b4e
35 changed files with 1567 additions and 467 deletions
|
@ -38,6 +38,38 @@ export function propertyKeys(o, expectedNames, expectedSymbols, label) {
|
|||
`${label}property symbols`);
|
||||
}
|
||||
|
||||
export function iterResultCustom(o, expectedValue, expectedDone, valueAsserter, label) {
|
||||
label = formatLabel(label);
|
||||
|
||||
assert_equals(typeof expectedDone, "boolean",
|
||||
`${label} iterResult assert usage check: expectedDone must be a boolean`);
|
||||
|
||||
propertyKeys(o, ["value", "done"], [], label);
|
||||
assert_equals(Object.getPrototypeOf(o), Object.prototype, `${label}prototype must be Object.prototype`);
|
||||
valueAsserter(o.value, expectedValue, `${label}value`);
|
||||
assert_equals(o.done, expectedDone, `${label}done`);
|
||||
}
|
||||
|
||||
export function iterResult(o, expectedValue, expectedDone, label) {
|
||||
return iterResultCustom(o, expectedValue, expectedDone, assert_equals, label);
|
||||
}
|
||||
|
||||
export function iterResultsCustom(actualArray, expectedArrayOfArrays, valueAsserter, label) {
|
||||
label = formatLabel(label);
|
||||
|
||||
assert_equals(actualArray.length, expectedArrayOfArrays.length,
|
||||
`${label} iterResults assert usage check: actual and expected must have the same length`);
|
||||
|
||||
for (let i = 0; i < actualArray.length; ++i) {
|
||||
const [expectedValue, expectedDone] = expectedArrayOfArrays[i];
|
||||
iterResultCustom(actualArray[i], expectedValue, expectedDone, valueAsserter, `${label}iter result ${i}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function iterResults(actualArray, expectedArrayOfArrays, label) {
|
||||
return iterResultsCustom(actualArray, expectedArrayOfArrays, assert_equals, label);
|
||||
}
|
||||
|
||||
export function methods(o, expectedMethods) {
|
||||
for (const [name, length] of Object.entries(expectedMethods)) {
|
||||
method(o, name, length);
|
||||
|
@ -103,5 +135,5 @@ function isConstructorTest(o) {
|
|||
}
|
||||
|
||||
function formatLabel(label) {
|
||||
return label !== undefined ? ` ${label}` : "";
|
||||
return label !== undefined ? `${label} ` : "";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue