зеркало из https://github.com/mozilla/gecko-dev.git
JavaScript Tests - update tests to account for bug 408957, not part of the build
This commit is contained in:
Родитель
1cb341361c
Коммит
8fd2612448
|
@ -53,7 +53,17 @@ function test()
|
|||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
(function() { for(i=0;i<4;++i) let x = 4; });
|
||||
try
|
||||
{
|
||||
eval('(function() { for(i=0;i<4;++i) let x = 4; })');
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
summary = 'let declaration must be direct child of block or top-level implicit block';
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
}
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
|
|
|
@ -52,8 +52,18 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
with({}) let y;
|
||||
|
||||
try
|
||||
{
|
||||
eval('with({}) let y;');
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
summary = 'let declaration must be direct child of block or top-level implicit block';
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
}
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
|
|
|
@ -52,8 +52,18 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
let(z) { with({}) let y = 3; }
|
||||
|
||||
try
|
||||
{
|
||||
eval('let(z) { with({}) let y = 3; }');
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
summary = 'let declaration must be direct child of block or top-level implicit block';
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
}
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
|
|
|
@ -52,8 +52,18 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
switch(let (a) 2) { case 0: let b; }
|
||||
|
||||
try
|
||||
{
|
||||
eval('switch(let (a) 2) { case 0: let b; }');
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
summary = 'let declaration must be direct child of block or top-level implicit block';
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
}
|
||||
|
||||
reportCompare(expect, actual, summary);
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ var gTestfile = 'regress-351070-01.js';
|
|||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 351070;
|
||||
var summary = 'decompilation of let declaration should not change scope';
|
||||
var summarytrunk = 'let declaration must be direct child of block or top-level implicit block';
|
||||
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
@ -52,24 +54,49 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
var f = function () { var a = 2; if (!!true) let a = 3; return a; }
|
||||
expect = 'function () { var a = 2; if (!!true) let a = 3; return a; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
|
||||
expect = 3;
|
||||
actual = f();
|
||||
reportCompare(expect, actual, summary);
|
||||
var f;
|
||||
var c;
|
||||
|
||||
f = function () { var a = 2; if (!!true) {let a = 3;} return a; }
|
||||
expect = 'function () { var a = 2; if (!!true) { let a = 3;} return a; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function () { var a = 2; if (!!true) let a = 3; return a; })';
|
||||
f = eval(c);
|
||||
expect = 'function () { var a = 2; if (!!true) let a = 3; return a; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
|
||||
expect = 2;
|
||||
actual = f();
|
||||
reportCompare(expect, actual, summary);
|
||||
expect = 3;
|
||||
actual = f();
|
||||
reportCompare(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
c = '(function () { var a = 2; if (!!true) {let a = 3;} return a; })';
|
||||
f = eval(c);
|
||||
expect = 'function () { var a = 2; if (!!true) { let a = 3;} return a; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
|
||||
expect = 2;
|
||||
actual = f();
|
||||
reportCompare(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ var gTestfile = 'regress-351070-03.js';
|
|||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 351070;
|
||||
var summary = 'decompilation of let declaration should not change scope';
|
||||
var summarytrunk = 'let declaration must be direct child of block or top-level implicit block';
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
@ -52,43 +53,121 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
|
||||
var c;
|
||||
var f;
|
||||
|
||||
f = function (x){if (x) if (y) z; else let w }
|
||||
expect = 'function (x){if (x) {if (y) { z; } else let w; }}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function (x){if (x) if (y) z; else let w })';
|
||||
f = eval(c);
|
||||
expect = 'function (x){if (x) {if (y) { z; } else let w; }}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
f = function (x){if (x){ if (y) z;} else let w }
|
||||
expect = 'function (x){if (x){ if (y) {z;}} else let w; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function (x){if (x){ if (y) z;} else let w })';
|
||||
f = eval(c);
|
||||
expect = 'function (x){if (x){ if (y) {z;}} else let w; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
f = function (x){if (x){ if (y) let z;} else let w }
|
||||
expect = 'function (x){if (x){ if (y) let z;} else let w; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function (x){if (x){ if (y) let z;} else let w })';
|
||||
f = eval(c);
|
||||
expect = 'function (x){if (x){ if (y) let z;} else let w; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
f = function f(){var a = 2; if (x) {let a = 3; print(a)} return a}
|
||||
expect = 'function f(){var a = 2; if (x) {let a = 3; print(a);} return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function f(){var a = 2; if (x) {let a = 3; print(a)} return a})';
|
||||
f = eval(c);
|
||||
expect = 'function f(){var a = 2; if (x) {let a = 3; print(a);} return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
f = function f(){var a = 2; if (x) {print(a);let a = 3} return a}
|
||||
expect = 'function f(){var a = 2; if (x) {print(a);let a = 3;} return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function f(){var a = 2; if (x) {print(a);let a = 3} return a})';
|
||||
f = eval(c);
|
||||
expect = 'function f(){var a = 2; if (x) {print(a);let a = 3;} return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
f = function f(){var a = 2; if (x) {let a = 3} return a}
|
||||
expect = 'function f(){var a = 2; if (x) {let a = 3;} return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function f(){var a = 2; if (x) {let a = 3} return a})';
|
||||
f = eval(c);
|
||||
expect = 'function f(){var a = 2; if (x) {let a = 3;} return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
f = function f(){var a = 2; if (x) let a = 3; return a}
|
||||
expect = 'function f(){var a = 2; if (x) let a = 3; return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function f(){var a = 2; if (x) let a = 3; return a})';
|
||||
f = eval(c);
|
||||
expect = 'function f(){var a = 2; if (x) let a = 3; return a;}';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
|
|
@ -52,12 +52,26 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
|
||||
var c;
|
||||
var f;
|
||||
f = function() { if(g) h; else let x; }
|
||||
expect = 'function() { if(g) { h; } else let x; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
|
||||
try
|
||||
{
|
||||
c = '(function() { if(g) h; else let x; })';
|
||||
f = eval(c);
|
||||
expect = 'function() { if(g) { h; } else let x; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
summary = 'let declaration must be direct child of block or top-level implicit block';
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summary);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
|
|
@ -52,13 +52,26 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
|
||||
var c;
|
||||
var f;
|
||||
|
||||
f = function() { if(x) { } else if (y) let b=2; }
|
||||
expect = 'function() { if(x) { } else if (y) let b=2; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function() { if(x) { } else if (y) let b=2; })';
|
||||
f = eval(c);
|
||||
expect = 'function() { if(x) { } else if (y) let b=2; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
summary = 'let declaration must be direct child of block or top-level implicit block';
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summary);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ var gTestfile = 'regress-352732.js';
|
|||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 352732;
|
||||
var summary = 'Decompiling "if (x) L: let x;"';
|
||||
var summarytrunk = 'let declaration must be direct child of block or top-level implicit block';
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
@ -52,16 +53,41 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
var f = (function() { if (x) L: let x; });
|
||||
expect = 'function() { if (x) { L: let x; } }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
|
||||
f = (function() { if (x) L: let x; else y; });
|
||||
expect = 'function() { if (x) { L: let x; } else { y;} }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
var c;
|
||||
var f;
|
||||
|
||||
try
|
||||
{
|
||||
c = '(function() { if (x) L: let x; })';
|
||||
f = eval(c);
|
||||
expect = 'function() { if (x) { L: let x; } }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
c = '(function() { if (x) L: let x; else y; })';
|
||||
f = eval(c);
|
||||
expect = 'function() { if (x) { L: let x; } else { y;} }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ var gTestfile = 'regress-356247.js';
|
|||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 356247;
|
||||
var summary = 'Decompilation of let {} = [1] in a loop';
|
||||
var summarytrunk = 'let declaration must be direct child of block or top-level implicit block';
|
||||
var actual = '';
|
||||
var expect = '';
|
||||
|
||||
|
@ -53,25 +54,50 @@ function test()
|
|||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
var f = function() { for(let x in []) let {} = [1]; };
|
||||
expect = 'function() { for(let x in []) let [] = [1]; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
|
||||
var g = eval('(' + f + ')');
|
||||
actual = g + '';
|
||||
compareSource(expect, actual, summary);
|
||||
var c;
|
||||
var f;
|
||||
var g;
|
||||
|
||||
f = function() { while(0) let {} = [1]; };
|
||||
expect = 'function() { while(0) let [] = [1]; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary);
|
||||
try
|
||||
{
|
||||
c = '(function() { for(let x in []) let {} = [1]; })';
|
||||
f = eval(c);
|
||||
expect = 'function() { for(let x in []) let [] = [1]; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary + ': f : ' + c);
|
||||
|
||||
g = eval('(' + f + ')');
|
||||
actual = g + '';
|
||||
compareSource(expect, actual, summary);
|
||||
g = eval('(' + f + ')');
|
||||
actual = g + '';
|
||||
compareSource(expect, actual, summary + ': g : ' + c);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
c = '(function() { while(0) let {} = [1]; })';
|
||||
f = eval(c);
|
||||
expect = 'function() { while(0) let [] = [1]; }';
|
||||
actual = f + '';
|
||||
compareSource(expect, actual, summary + ': f : ' + c);
|
||||
|
||||
g = eval('(' + f + ')');
|
||||
actual = g + '';
|
||||
compareSource(expect, actual, summary + ': g : ' + c);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summarytrunk + ': ' + c);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
|
|
@ -53,38 +53,49 @@ function test()
|
|||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
var pfx = "(function f() { var n = 2, a = 2; ",
|
||||
decl = " let a = 3;",
|
||||
end = " return a; })";
|
||||
try
|
||||
{
|
||||
var pfx = "(function f() { var n = 2, a = 2; ",
|
||||
decl = " let a = 3;",
|
||||
end = " return a; })";
|
||||
|
||||
var table = [
|
||||
["if (!!true)", ""],
|
||||
["if (!!true)", " else foopy();"],
|
||||
["if (!true); else", ""],
|
||||
["do ", " while (false);"],
|
||||
["while (--n)", ""],
|
||||
["for (--n;n;--n)", ""],
|
||||
["for (a in this)", ""],
|
||||
["with (this)", ""],
|
||||
];
|
||||
var table = [
|
||||
["if (!!true)", ""],
|
||||
["if (!!true)", " else foopy();"],
|
||||
["if (!true); else", ""],
|
||||
["do ", " while (false);"],
|
||||
["while (--n)", ""],
|
||||
["for (--n;n;--n)", ""],
|
||||
["for (a in this)", ""],
|
||||
["with (this)", ""],
|
||||
];
|
||||
|
||||
expect = 3;
|
||||
expect = 3;
|
||||
|
||||
for (i = 0; i < table.length; i++) {
|
||||
var src = pfx + table[i][0] + decl + table[i][1] + end;
|
||||
print('src: ' + src);
|
||||
var fun = eval(src);
|
||||
var testval = fun();
|
||||
reportCompare(expect, testval, summary + ': ' + src);
|
||||
if (testval != expect) {
|
||||
break;
|
||||
for (i = 0; i < table.length; i++) {
|
||||
var src = pfx + table[i][0] + decl + table[i][1] + end;
|
||||
print('src: ' + src);
|
||||
var fun = eval(src);
|
||||
var testval = fun();
|
||||
reportCompare(expect, testval, summary + ': ' + src);
|
||||
if (testval != expect) {
|
||||
break;
|
||||
}
|
||||
print('uneval: ' + uneval(fun));
|
||||
var declsrc = '(' +
|
||||
src.slice(1, -1).replace('function f', 'function f' + i) + ')';
|
||||
print('declsrc: ' + declsrc);
|
||||
this['f' + i] = eval(declsrc);
|
||||
print('f' + i + ': ' + this['f' + i]);
|
||||
}
|
||||
print('uneval: ' + uneval(fun));
|
||||
var declsrc = '(' +
|
||||
src.slice(1, -1).replace('function f', 'function f' + i) + ')';
|
||||
print('declsrc: ' + declsrc);
|
||||
this['f' + i] = eval(declsrc);
|
||||
print('f' + i + ': ' + this['f' + i]);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=408957
|
||||
summary = 'let declaration must be direct child of block or top-level implicit block';
|
||||
expect = 'SyntaxError';
|
||||
actual = ex.name;
|
||||
reportCompare(expect, actual, summary);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
|
|
Загрузка…
Ссылка в новой задаче