Bug 1319512 - Adjust expression closure tests. r=jandem

This commit is contained in:
Tom Schuster 2017-11-15 16:19:37 +01:00
Родитель 3f07871197
Коммит be406a264f
18 изменённых файлов: 43 добавлений и 25 удалений

Просмотреть файл

@ -1112,10 +1112,12 @@ function test_syntax(postfixes, check_error, ignore_opts) {
// Expression closures
if (getBuildConfiguration().release_or_beta) {
test("function f() 1 ");
test("function f() 1; ");
test("(function () 1 ");
test("(function () 1); ");
}
// for each...in

Просмотреть файл

@ -1,12 +1,16 @@
load(libdir + "asm.js");
load(libdir + "asserts.js");
if (getBuildConfiguration().release_or_beta) {
assertAsmTypeFail(USE_ASM + 'function f() 0');
assertAsmTypeFail(USE_ASM + 'function f() 0; return 0');
assertAsmTypeFail(USE_ASM + 'function f() 0; return f');
}
assertAsmTypeFail(USE_ASM);
assertAsmTypeFail(USE_ASM + 'return');
assertAsmTypeFail(USE_ASM + 'function f() 0');
assertAsmTypeFail(USE_ASM + 'function f(){}');
assertAsmTypeFail(USE_ASM + 'function f(){} return 0');
assertAsmTypeFail(USE_ASM + 'function f() 0; return 0');
assertAsmTypeFail(USE_ASM + 'function f(){} return g');
assertAsmTypeFail(USE_ASM + 'function f(){} function f(){} return f');
assertAsmTypeFail(USE_ASM + 'function f(){}; function g(){}; return {f, g}');
@ -16,7 +20,6 @@ assertAsmTypeFail(USE_ASM + 'var f=glob.Math.imul; return {}');
assertAsmTypeFail('glob', USE_ASM + 'var f=glob.Math.imul; function f(){} return f');
assertAsmTypeFail('glob','foreign', USE_ASM + 'var f=foreign.foo; function f(){} return f');
assertAsmTypeFail(USE_ASM + 'function f(){} var f=[f,f]; return f');
assertAsmTypeFail(USE_ASM + 'function f() 0; return f');
assertAsmTypeFail('"use strict";' + USE_ASM + 'function f() {} return f');
assertAsmTypeFail(USE_ASM + '"use strict"; function f() {} return f');
assertAsmTypeFail(USE_ASM + '"use foopy" + 1; function f() {} return f');

Просмотреть файл

@ -10,5 +10,7 @@ f = Function("");
assertEq(f.toString(), "function anonymous(\n) {\n\n}");
f = Function("", "(abc)");
assertEq(f.toString(), "function anonymous(\n) {\n(abc)\n}");
if (getBuildConfiguration().release_or_beta) {
f = Function("", "return function (a,b) a + b;")();
assertEq(f.toString(), "function (a,b) a + b");
}

Просмотреть файл

@ -1,3 +1,5 @@
if (getBuildConfiguration().release_or_beta)
eval(`
function f1(foo, bar) foo + bar;
assertEq(f1.toString(), "function f1(foo, bar) foo + bar");
assertEq(f1.toString(), f1.toSource());
@ -29,3 +31,4 @@ test\
assertEq(f7.toString(), "function (foo, bar) foo + bar + '\\\nlong\\\nstring\\\ntest\\\n'");
assertEq(f7.toSource(), "(" + f7.toString() + ")");
`);

Просмотреть файл

@ -6,7 +6,7 @@ expected = 'nocrash,';
let z = {};
for (var i = 0; i < 4; ++i) {
for each (var e in [{}, 1, {}]) {
+(function () z)();
+(function () { return z; })();
}
}

Просмотреть файл

@ -6,7 +6,7 @@ expected = '0 0 0 0 0 0 0 0 0,';
var unused = 0;
let zero = 0;
for (var ee = 0; ee < 1; ++ee) {
o.push((function () zero)());
o.push((function () { return zero; })());
}
}
appendToActual(o.join(" "));

Просмотреть файл

@ -1,3 +1,5 @@
if (getBuildConfiguration().release_or_beta)
eval(`
m = {
i() {},
n() {},
@ -39,3 +41,4 @@ function ()[{
t = function () {};
getLcovInfo();
relazifyFunctions();
`);

Просмотреть файл

@ -1,6 +1,6 @@
// |jit-test| error: ReferenceError
var t = {};
function r(y) t.y = y;
function r(y) { return t.y = y; }
function g() {
for (let [x = r(x)] of x) {}
}

Просмотреть файл

@ -1,6 +1,6 @@
// |jit-test| error: ReferenceError
var t = {};
function r(y) t.y = y;
function r(y) { return t.y = y; }
function g() {
for (let [x = r(x)] in x) {}
}

Просмотреть файл

@ -1,6 +1,9 @@
if (getBuildConfiguration().release_or_beta) {
eval(`
function f() {
if (0)
function g() x;
function g() { x };
else;
}
f();
f();`)
}

Просмотреть файл

@ -7,6 +7,9 @@ function testWarn(code) {
// Warning for expression closure is non-release-only (not Release/Beta).
testPass(code);
return;
} else {
// !!! expression closures are currently completely disabled in Nightly
return;
}
enableLastWarning();

Просмотреть файл

@ -1,8 +1,4 @@
Reflect.parse(`
function a()f1()
f2()
`);
Reflect.parse(`
let a
f2()
`);

Просмотреть файл

@ -1 +1 @@
function d([{ [yield]: {} } ]) f
function d([{ [yield]: {} } ]) { f }

Просмотреть файл

@ -1,7 +1,7 @@
g = newGlobal();
g.parent = this;
g.eval(`(function() {
Debugger(parent).onExceptionUnwind = function(frame) frame.eval("")
Debugger(parent).onExceptionUnwind = function(frame) { return frame.eval(""); }
})()`);
var module = new WebAssembly.Module(wasmTextToBinary(`

Просмотреть файл

@ -1,3 +1,4 @@
// |reftest| skip-if(!release_or_beta)
/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
/*
* Any copyright is dedicated to the Public Domain.

Просмотреть файл

@ -1,3 +1,4 @@
// |reftest| skip-if(!release_or_beta)
/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
/*
* Any copyright is dedicated to the Public Domain.

Просмотреть файл

@ -1,3 +1,4 @@
// |reftest| skip-if(!release_or_beta)
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this

Просмотреть файл

@ -1,4 +1,4 @@
// |reftest| skip-if(!xulRuntime.shell)
// |reftest| skip-if(!xulRuntime.shell||!release_or_beta)
function test() {
// expression closures