зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1319512 - Adjust expression closure tests. r=jandem
This commit is contained in:
Родитель
3f07871197
Коммит
be406a264f
|
@ -1112,10 +1112,12 @@ function test_syntax(postfixes, check_error, ignore_opts) {
|
|||
|
||||
// Expression closures
|
||||
|
||||
test("function f() 1 ");
|
||||
test("function f() 1; ");
|
||||
test("(function () 1 ");
|
||||
test("(function () 1); ");
|
||||
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}");
|
||||
f = Function("", "return function (a,b) a + b;")();
|
||||
assertEq(f.toString(), "function (a,b) a + b");
|
||||
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 @@
|
|||
function f() {
|
||||
if (0)
|
||||
function g() x;
|
||||
else;
|
||||
if (getBuildConfiguration().release_or_beta) {
|
||||
eval(`
|
||||
function f() {
|
||||
if (0)
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче