mirror of https://github.com/tc39/test262.git
31 lines
656 B
JavaScript
31 lines
656 B
JavaScript
// Copyright (C) 2018 Leo Balter. All rights reserved.
|
|
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
/*---
|
|
description: thrower in the middle
|
|
flags: [async]
|
|
---*/
|
|
|
|
var throwable = new Test262Error("lol");
|
|
var p = Promise.resolve(42);
|
|
|
|
Object.defineProperty(p, "constructor", {
|
|
get() {
|
|
throw throwable;
|
|
}
|
|
});
|
|
|
|
async function fn() {
|
|
return await p;
|
|
}
|
|
|
|
fn().then(
|
|
result => {
|
|
throw new Test262Error("Promise should be rejected.");
|
|
},
|
|
error => {
|
|
assert.sameValue(error, throwable, "Promise should be rejected with throwable");
|
|
}
|
|
).then($DONE, $DONE);
|
|
|