mirror of https://github.com/tc39/test262.git
Merge pull request #1861 from test262-automation/javascriptcore-test262-automation-export-f595c41625
Import test changes from JavaScriptCore
This commit is contained in:
commit
2b726b73e4
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"sourceRevisionAtLastExport": "d44c4f5a10",
|
"sourceRevisionAtLastExport": "54374edc2b",
|
||||||
"targetRevisionAtLastExport": "f595c41625",
|
"targetRevisionAtLastExport": "bbc9ae15d9",
|
||||||
"curatedFiles": {
|
"curatedFiles": {
|
||||||
"/stress/Number-isNaN-basics.js": "DELETED_IN_TARGET",
|
"/stress/Number-isNaN-basics.js": "DELETED_IN_TARGET",
|
||||||
"/stress/Object_static_methods_Object.getOwnPropertyDescriptors-proxy.js": "DELETED_IN_TARGET",
|
"/stress/Object_static_methods_Object.getOwnPropertyDescriptors-proxy.js": "DELETED_IN_TARGET",
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
function shouldBe(actual, expected) {
|
||||||
|
if (actual !== expected)
|
||||||
|
throw new Error('bad value: ' + actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldThrow(func, errorMessage) {
|
||||||
|
var errorThrown = false;
|
||||||
|
var error = null;
|
||||||
|
try {
|
||||||
|
func();
|
||||||
|
} catch (e) {
|
||||||
|
errorThrown = true;
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
if (!errorThrown)
|
||||||
|
throw new Error('not thrown');
|
||||||
|
if (String(error) !== errorMessage)
|
||||||
|
throw new Error(`bad error: ${String(error)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < 10; ++i) {
|
||||||
|
var f = Function('/*) {\n*/', 'return 42');
|
||||||
|
shouldBe(f.toString(),
|
||||||
|
`function anonymous(/*) {
|
||||||
|
*/) {
|
||||||
|
return 42
|
||||||
|
}`);
|
||||||
|
}
|
||||||
|
shouldThrow(() => Function('/*', '*/){\nreturn 42'), `SyntaxError: Parameters should match arguments offered as parameters in Function constructor.`);
|
||||||
|
|
||||||
|
shouldThrow(() => Function('/*', '*/){\nreturn 43'), `SyntaxError: Parameters should match arguments offered as parameters in Function constructor.`);
|
||||||
|
for (var i = 0; i < 10; ++i) {
|
||||||
|
var f = Function('/*) {\n*/', 'return 43');
|
||||||
|
shouldBe(f.toString(),
|
||||||
|
`function anonymous(/*) {
|
||||||
|
*/) {
|
||||||
|
return 43
|
||||||
|
}`);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
function shouldBe(actual, expected) {
|
||||||
|
if (actual !== expected)
|
||||||
|
throw new Error('bad value: ' + actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
var GeneratorFunction = function*(){}.constructor;
|
||||||
|
var AsyncFunction = async function(){}.constructor;
|
||||||
|
var AsyncGeneratorFunction = async function*(){}.constructor;
|
||||||
|
|
||||||
|
var f = Function(`return 42`);
|
||||||
|
shouldBe(typeof anonymous, `undefined`);
|
||||||
|
shouldBe(f.toString(),
|
||||||
|
`function anonymous() {
|
||||||
|
return 42
|
||||||
|
}`);
|
||||||
|
|
||||||
|
var gf = GeneratorFunction(`return 42`);
|
||||||
|
shouldBe(typeof anonymous, `undefined`);
|
||||||
|
shouldBe(gf.toString(),
|
||||||
|
`function* anonymous() {
|
||||||
|
return 42
|
||||||
|
}`);
|
||||||
|
|
||||||
|
var af = AsyncFunction(`return 42`);
|
||||||
|
shouldBe(typeof anonymous, `undefined`);
|
||||||
|
shouldBe(af.toString(),
|
||||||
|
`async function anonymous() {
|
||||||
|
return 42
|
||||||
|
}`);
|
||||||
|
|
||||||
|
var agf = AsyncGeneratorFunction(`return 42`);
|
||||||
|
shouldBe(typeof anonymous, `undefined`);
|
||||||
|
shouldBe(agf.toString(),
|
||||||
|
`async function* anonymous() {
|
||||||
|
return 42
|
||||||
|
}`);
|
Loading…
Reference in New Issue