test262-automation e9a5a7f918 [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time) (#1620)
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
2018-07-03 15:59:58 -04:00

37 lines
697 B
JavaScript

function assert(b) {
if (!b)
throw new Error("Bad");
}
async function* asyncIterator() {
yield 42;
}
function test1() {
let p = asyncIterator();
p.next().then((x) => {
assert(x.value === 42);
assert(x.done === false);
});
p.__proto__ = {};
assert(p.next === undefined);
}
test1();
let error = null;
async function test2() {
let p2 = asyncIterator();
p2.__proto__ = {};
try {
for await (let x of p2) {
throw new Error("Bad!");
}
}
catch(e) {
error = e;
}
}
test2();
assert(error instanceof TypeError);
assert(error.message === "undefined is not a function (near '...x of p2...')");