mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 14:04:51 +02:00
parent
57c7d06bf1
commit
5217ef396e
@ -28,7 +28,8 @@ function asyncTest(testFunc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
assert.throwsAsync = function (expectedErrorConstructor, func, message) {
|
||||||
|
return new Promise(function (resolve) {
|
||||||
var innerThenable;
|
var innerThenable;
|
||||||
if (message === undefined) {
|
if (message === undefined) {
|
||||||
message = "";
|
message = "";
|
||||||
@ -63,7 +64,7 @@ assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return innerThenable.then(
|
resolve(innerThenable.then(
|
||||||
function () {
|
function () {
|
||||||
message +=
|
message +=
|
||||||
"Expected a " +
|
"Expected a " +
|
||||||
@ -91,7 +92,7 @@ assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
|||||||
throw new Test262Error(message);
|
throw new Test262Error(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
));
|
||||||
} catch (thrown) {
|
} catch (thrown) {
|
||||||
if (typeof thrown !== "object" || thrown === null) {
|
if (typeof thrown !== "object" || thrown === null) {
|
||||||
message +=
|
message +=
|
||||||
@ -108,4 +109,5 @@ assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
|
|||||||
}
|
}
|
||||||
throw new Test262Error(message);
|
throw new Test262Error(message);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@ -9,8 +9,8 @@ flags: [async]
|
|||||||
includes: [asyncHelpers.js]
|
includes: [asyncHelpers.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
asyncTest(async function() {
|
asyncTest(function () {
|
||||||
await assert.throwsAsync(
|
return assert.throwsAsync(
|
||||||
Test262Error,
|
Test262Error,
|
||||||
function () {
|
function () {
|
||||||
Promise.try(function () { throw new Test262Error(); })
|
Promise.try(function () { throw new Test262Error(); })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user