mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 14:30:27 +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)
108 lines
3.0 KiB
JavaScript
108 lines
3.0 KiB
JavaScript
function shouldBe(actual, expected)
|
|
{
|
|
if (actual !== expected)
|
|
throw new Error(`bad value: ${String(actual)}`);
|
|
}
|
|
|
|
(function () {
|
|
function *g1(a, b, c)
|
|
{
|
|
yield arguments;
|
|
yield arguments;
|
|
}
|
|
|
|
var g = g1(0, 1, 2);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
|
|
function *g2(a, b, c)
|
|
{
|
|
yield arguments;
|
|
yield arguments;
|
|
a = yield a;
|
|
yield arguments;
|
|
b = yield b;
|
|
yield arguments;
|
|
c = yield c;
|
|
yield arguments;
|
|
}
|
|
var g = g2(0, 1, 2);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 0);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":42,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 1);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":42,"1":42,"2":2}`);
|
|
shouldBe(g.next().value, 2);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":42,"1":42,"2":42}`);
|
|
}());
|
|
|
|
(function () {
|
|
function *g1(a, b, c)
|
|
{
|
|
"use strict";
|
|
yield arguments;
|
|
yield arguments;
|
|
}
|
|
|
|
var g = g1(0, 1, 2);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
|
|
function *g2(a, b, c)
|
|
{
|
|
"use strict";
|
|
yield arguments;
|
|
yield arguments;
|
|
a = yield a;
|
|
yield arguments;
|
|
b = yield b;
|
|
yield arguments;
|
|
c = yield c;
|
|
yield arguments;
|
|
}
|
|
var g = g2(0, 1, 2);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 0);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 1);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 2);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":0,"1":1,"2":2}`);
|
|
}());
|
|
|
|
(function () {
|
|
"use strict";
|
|
function *g1(a, b, c)
|
|
{
|
|
yield arguments;
|
|
yield arguments;
|
|
}
|
|
|
|
var g = g1(0, 1, 2);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
|
|
function *g2(a, b, c)
|
|
{
|
|
yield arguments;
|
|
yield arguments;
|
|
a = yield a;
|
|
yield arguments;
|
|
b = yield b;
|
|
yield arguments;
|
|
c = yield c;
|
|
yield arguments;
|
|
}
|
|
var g = g2(0, 1, 2);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(JSON.stringify(g.next().value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 0);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 1);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":0,"1":1,"2":2}`);
|
|
shouldBe(g.next().value, 2);
|
|
shouldBe(JSON.stringify(g.next(42).value), `{"0":0,"1":1,"2":2}`);
|
|
}());
|