thrower in the middle

This commit is contained in:
Rick Waldron 2018-07-25 20:35:14 -04:00
parent 4314e2cab3
commit 5867eb3f1a
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// 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);