bug 462470 - JavaScript Tests - deal with changes in decompilation and behavior from bug 461233.

This commit is contained in:
Bob Clary 2008-11-27 02:29:24 -08:00
parent 39334219ec
commit abb35d9061
12 changed files with 470 additions and 5 deletions

View File

@ -58,12 +58,12 @@ function test()
f = function() { g(h) = (delete let (y) 3); }
actual = f + '';
expect = 'function () {\n g(h) = ((let (y) 3), true);\n}';
compareSource(expect, actual, summary);
compareSource(expect, actual, summary + ': 1');
f = function () { g(h) = ((let (y) 3), true);}
actual = f + '';
expect = 'function () {\n g(h) = ((let (y) 3), true);\n}';
compareSource(expect, actual, summary);
compareSource(expect, actual, summary + ': 2');
exitFunc ('test');
}

View File

@ -56,7 +56,7 @@ function test()
{ alert(1); for((let(y=3) let(y=4) y); 0; x++) ; alert(6); }
expect = 'function () {\n alert(1);\n' +
' for ((let (y = 3) (let (y = 4) y)); false; x++) {\n' +
' for (let (y = 3) let (y = 4) y; false; x++) {\n' +
' }\n' +
' alert(6);\n' +
'}';

View File

@ -0,0 +1,87 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
* Jeff Walden
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-350991.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 350991;
var summary = 'decompilation of function () { for (let...;...;}} ';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var f;
expect = 'function () {\n for (let (y) 3;;) {\n }\n}';
try
{
f = eval('(function () { for ((let (y) 3); ;) { } })');
actual = f + '';
}
catch(ex)
{
actual = ex + '';
}
compareSource(expect, actual, summary);
expect = 'function () {\n let x = 5;\n while (x-- > 0) {\n' +
' for (let x = x, q = 5;;) {\n }\n }\n}';
try
{
f = function() { let x = 5; while (x-- > 0) { for (let x = x, q = 5;;); } }
actual = f + '';
}
catch(ex)
{
actual = ex + '';
}
compareSource(expect, actual, summary);
exitFunc ('test');
}

View File

@ -0,0 +1,75 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Brendan Eich
* Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-352011.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 352011;
var summary = 'decompilation of statements that begin with object literals';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var f;
f = function() { ({}.y = i); }
expect = 'function() { ({}.y = i); }';
actual = f + '';
compareSource(expect, actual, summary);
f = function() { let(x) ({t:x}) }
expect = 'function() { let(x) ({t:x}); }';
actual = f + '';
compareSource(expect, actual, summary);
f = function() { (let(x) {y: z}) }
expect = 'function() { let(x) ({y: z}); }';
actual = f + '';
compareSource(expect, actual, summary);
exitFunc ('test');
}

View File

@ -0,0 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-352022.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 352022;
var summary = 'decompilation of let, delete and parens';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var f;
f = function() { g(h) = (delete let (y) 3); }
actual = f + '';
expect = 'function () {\n g(h) = (let (y) 3, true);\n}';
compareSource(expect, actual, summary + ': 1');
f = function () { g(h) = ((let (y) 3), true);}
actual = f + '';
expect = 'function () {\n g(h) = (let (y) 3, true);\n}';
compareSource(expect, actual, summary + ': 2');
exitFunc ('test');
}

View File

@ -61,7 +61,7 @@ function test()
compareSource(expect, actual, summary);
f = function f(){g((let(a=b)c,d),e)}
expect = 'function f(){g(((let(a=b)c),d),e);}';
expect = 'function f(){g((let(a=b)c,d),e);}';
actual = f + '';
compareSource(expect, actual, summary);
@ -71,7 +71,7 @@ function test()
compareSource(expect, actual, summary);
f = function() { (let(s=4){foo:"bar"}) }
expect = 'function() { (let(s=4)({foo:"bar"})); }';
expect = 'function() { let(s=4)({foo:"bar"}); }';
actual = f + '';
compareSource(expect, actual, summary);

View File

@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-352609.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 352609;
var summary = 'decompilation of |let| expression for |is not a function| error';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = /TypeError: 0 is not a function/;
try
{
[let (x = 3, y = 4) x].map(0);
}
catch(ex)
{
actual = ex + '';
}
reportMatch(expect, actual, '[let (x = 3, y = 4) x].map(0)');
expect = /TypeError: (p.z = \[let \(x = 3, y = 4\) x\]|.*Array.*) is not a function/;
try
{
var p = {}; (p.z = [let (x = 3, y = 4) x])();
}
catch(ex)
{
actual = ex + '';
}
reportMatch(expect, actual, 'p = {}; (p.z = [let (x = 3, y = 4) x])()');
expect = /TypeError: (p.z = let \(x\) x|.*Undefined.*) is not a function/;
try
{
var p = {}; (p.z = let(x) x)()
}
catch(ex)
{
actual = ex + '';
}
reportMatch(expect, actual, 'p = {}; (p.z = let(x) x)()');
exitFunc ('test');
}

View File

@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-353249.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 353249;
var summary = 'regression test for bug 353249';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var f = (function () { let (x) <x/>.(1) < let (z) eval('3');
for (x in this) {} });
expect = 'function () { let (x) <x/>.((1)) < (let (z) eval("3")); ' +
'for (x in this) {} }';
actual = f + '';
compareSource(expect, actual, summary);
// do not crash()
f();
exitFunc ('test');
}

View File

View File

@ -0,0 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-420399.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 420399;
var summary = 'Let expression error involving undefined';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = /TypeError: let \(a = undefined\) a (is undefined|has no properties)/;
try
{
(let (a=undefined) a).b = 3;
}
catch(ex)
{
actual = ex + '';
}
reportMatch(expect, actual, summary);
exitFunc ('test');
}

View File

@ -0,0 +1 @@
gTestsubsuite='regress';

View File

@ -134,3 +134,10 @@ js1_7/decompilation/regress-352026.js
# https://bugzilla.mozilla.org/show_bug.cgi?id=458851#c7
js1_5/extensions/regress-437288-01.js
js1_5/decompilation/regress-437288-02.js
# more decompilation changes, bug 461233
js1_7/block/regress-352609.js
js1_7/decompilation/regress-352011.js
js1_7/decompilation/regress-352022.js
js1_7/extensions/regress-353249.js
js1_7/regress/regress-420399.js
js1_7/decompilation/regress-350991.js