mirror of https://github.com/tc39/test262.git
thrower in the middle
This commit is contained in:
parent
4314e2cab3
commit
5867eb3f1a
|
@ -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);
|
||||
|
Loading…
Reference in New Issue