mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 22:40:28 +02:00
* [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)
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
function shouldBe(actual, expected) {
|
|
if (actual !== expected)
|
|
throw new Error('bad value: ' + actual);
|
|
}
|
|
|
|
function *generatorFunction() {
|
|
}
|
|
let generator = generatorFunction();
|
|
|
|
shouldBe(generator instanceof generatorFunction, true);
|
|
shouldBe(typeof generator.__proto__, 'object');
|
|
shouldBe(generator.__proto__, generatorFunction.prototype);
|
|
|
|
let GeneratorPrototype = generator.__proto__.__proto__;
|
|
|
|
let GeneratorFunctionPrototype = generatorFunction.__proto__;
|
|
let GeneratorFunction = generatorFunction.__proto__.constructor;
|
|
shouldBe(GeneratorFunction.prototype, GeneratorFunctionPrototype);
|
|
shouldBe(generatorFunction instanceof GeneratorFunction, true);
|
|
shouldBe(GeneratorFunction.__proto__, Function);
|
|
shouldBe(GeneratorFunctionPrototype.__proto__, Function.prototype);
|
|
|
|
shouldBe(GeneratorFunctionPrototype.prototype, GeneratorPrototype);
|
|
shouldBe(GeneratorPrototype.constructor, GeneratorFunctionPrototype);
|
|
|
|
let arrayIterator = [][Symbol.iterator]();
|
|
let ArrayIteratorPrototype = arrayIterator.__proto__;
|
|
let IteratorPrototype = ArrayIteratorPrototype.__proto__;
|
|
|
|
shouldBe(IteratorPrototype, GeneratorPrototype.__proto__);
|