diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/js1_5/Expressions | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/js1_5/Expressions')
-rw-r--r-- | js/src/tests/js1_5/Expressions/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/js1_5/Expressions/regress-192288.js | 85 | ||||
-rw-r--r-- | js/src/tests/js1_5/Expressions/regress-394673.js | 49 | ||||
-rw-r--r-- | js/src/tests/js1_5/Expressions/regress-96526-argsub.js | 91 | ||||
-rw-r--r-- | js/src/tests/js1_5/Expressions/regress-96526-delelem.js | 91 | ||||
-rw-r--r-- | js/src/tests/js1_5/Expressions/regress-96526-noargsub.js | 91 | ||||
-rw-r--r-- | js/src/tests/js1_5/Expressions/shell.js | 103 |
7 files changed, 510 insertions, 0 deletions
diff --git a/js/src/tests/js1_5/Expressions/browser.js b/js/src/tests/js1_5/Expressions/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/js1_5/Expressions/browser.js diff --git a/js/src/tests/js1_5/Expressions/regress-192288.js b/js/src/tests/js1_5/Expressions/regress-192288.js new file mode 100644 index 000000000..da4e35824 --- /dev/null +++ b/js/src/tests/js1_5/Expressions/regress-192288.js @@ -0,0 +1,85 @@ +/* -*- 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 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * + * Date: 07 February 2003 + * SUMMARY: Testing 0/0 inside functions + * + * See http://bugzilla.mozilla.org/show_bug.cgi?id=192288 + * + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 192288; +var summary = 'Testing 0/0 inside functions '; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + + +function f() +{ + return 0/0; +} + +status = inSection(1); +actual = isNaN(f()); +expect = true; +addThis(); + +status = inSection(2); +actual = isNaN(f.apply(this)); +expect = true; +addThis(); + +status = inSection(3); +actual = isNaN(eval("f.apply(this)")); +expect = true; +addThis(); + +status = inSection(4); +actual = isNaN(Function('return 0/0;')()); +expect = true; +addThis(); + +status = inSection(5); +actual = isNaN(eval("Function('return 0/0;')()")); +expect = true; +addThis(); + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Expressions/regress-394673.js b/js/src/tests/js1_5/Expressions/regress-394673.js new file mode 100644 index 000000000..8b22e65f6 --- /dev/null +++ b/js/src/tests/js1_5/Expressions/regress-394673.js @@ -0,0 +1,49 @@ +/* -*- 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 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 394673; +var summary = 'Parsing long chains of "&&" or "||"'; +var actual = 'No Error'; +var expect = 'No Error'; + +printBugNumber(BUGNUMBER); +printStatus (summary); + +var N = 70*1000; +var counter; + +counter = 0; +var x = build("&&")(); +if (x !== true) + throw "Unexpected result: x="+x; +if (counter != N) + throw "Unexpected counter: counter="+counter; + +counter = 0; +var x = build("||")(); +if (x !== true) + throw "Unexpected result: x="+x; +if (counter != 1) + throw "Unexpected counter: counter="+counter; + +function build(operation) +{ + var counter; + var a = []; + a.push("return f()"); + for (var i = 1; i != N - 1; ++i) + a.push("f()"); + a.push("f();"); + return new Function(a.join(operation)); +} + +function f() +{ + ++counter; + return true; +} + +reportCompare(expect, actual, summary); diff --git a/js/src/tests/js1_5/Expressions/regress-96526-argsub.js b/js/src/tests/js1_5/Expressions/regress-96526-argsub.js new file mode 100644 index 000000000..e78c2d2b1 --- /dev/null +++ b/js/src/tests/js1_5/Expressions/regress-96526-argsub.js @@ -0,0 +1,91 @@ +/* -*- 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 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * + * Date: 29 Oct 2002 + * SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k] + * See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52 + * + * Brendan: "The idea is to cover all the 'use' and 'set' (as in modify) + * operations you can do on an expression like a[i][j][k], including variations + * where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc. + * (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)." + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 96526; +var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var z='magic'; +Number.prototype.magic=42; + +status = inSection(1); +actual = f(2,1,[1,2,[3,4]]); +expect = 42; +addThis(); + + +function f(j,k) +{ + status = inSection(2); + actual = formatArray(arguments[2]); + expect = formatArray([1,2,[3,4]]); + addThis(); + + status = inSection(3); + actual = formatArray(arguments[2][j]); + expect = formatArray([3,4]); + addThis(); + + status = inSection(4); + actual = arguments[2][j][k]; + expect = 4; + addThis(); + + status = inSection(5); + actual = arguments[2][j][k][z]; + expect = 42; + addThis(); + + return arguments[2][j][k][z]; +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Expressions/regress-96526-delelem.js b/js/src/tests/js1_5/Expressions/regress-96526-delelem.js new file mode 100644 index 000000000..d66faed4e --- /dev/null +++ b/js/src/tests/js1_5/Expressions/regress-96526-delelem.js @@ -0,0 +1,91 @@ +/* -*- 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 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * + * Date: 29 Oct 2002 + * SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k] + * See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52 + * + * Brendan: "The idea is to cover all the 'use' and 'set' (as in modify) + * operations you can do on an expression like a[i][j][k], including variations + * where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc. + * (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)." + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 96526; +var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var z='magic'; +Number.prototype.magic=42; +f(2,1,[-1,0,[1,2,[3,4]]]); + +function f(j,k,a) +{ + status = inSection(1); + actual = formatArray(a[2]); + expect = formatArray([1,2,[3,4]]); + addThis(); + + status = inSection(2); + actual = formatArray(a[2][j]); + expect = formatArray([3,4]); + addThis(); + + status = inSection(3); + actual = a[2][j][k]; + expect = 4; + addThis(); + + status = inSection(4); + actual = a[2][j][k][z]; + expect = 42; + addThis(); + + delete a[2][j][k]; + + status = inSection(5); + actual = formatArray(a[2][j]); + expect = '[3, ,]'; + addThis(); +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Expressions/regress-96526-noargsub.js b/js/src/tests/js1_5/Expressions/regress-96526-noargsub.js new file mode 100644 index 000000000..3b25ab312 --- /dev/null +++ b/js/src/tests/js1_5/Expressions/regress-96526-noargsub.js @@ -0,0 +1,91 @@ +/* -*- 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 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * + * Date: 29 Oct 2002 + * SUMMARY: Testing "use" and "set" operations on expressions like a[i][j][k] + * See http://bugzilla.mozilla.org/show_bug.cgi?id=96526#c52 + * + * Brendan: "The idea is to cover all the 'use' and 'set' (as in modify) + * operations you can do on an expression like a[i][j][k], including variations + * where you replace |a| with arguments (literally) and |i| with 0, 1, 2, etc. + * (to hit the optimization for arguments[0]... that uses JSOP_ARGSUB)." + */ +//----------------------------------------------------------------------------- +var UBound = 0; +var BUGNUMBER = 96526; +var summary = 'Testing "use" and "set" ops on expressions like a[i][j][k]'; +var status = ''; +var statusitems = []; +var actual = ''; +var actualvalues = []; +var expect= ''; +var expectedvalues = []; + +var z='magic'; +Number.prototype.magic=42; + +status = inSection(1); +actual = f(2,1,[-1,0,[1,2,[3,4]]]); +expect = 42; +addThis(); + + +function f(j,k,a) +{ + status = inSection(2); + actual = formatArray(a[2]); + expect = formatArray([1,2,[3,4]]); + addThis(); + + status = inSection(3); + actual = formatArray(a[2][j]); + expect = formatArray([3,4]); + addThis(); + + status = inSection(4); + actual = a[2][j][k]; + expect = 4; + addThis(); + + status = inSection(5); + actual = a[2][j][k][z]; + expect = 42; + addThis(); + + return a[2][j][k][z]; +} + + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + + + +function addThis() +{ + statusitems[UBound] = status; + actualvalues[UBound] = actual; + expectedvalues[UBound] = expect; + UBound++; +} + + +function test() +{ + enterFunc('test'); + printBugNumber(BUGNUMBER); + printStatus(summary); + + for (var i=0; i<UBound; i++) + { + reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); + } + + exitFunc ('test'); +} diff --git a/js/src/tests/js1_5/Expressions/shell.js b/js/src/tests/js1_5/Expressions/shell.js new file mode 100644 index 000000000..de97dad87 --- /dev/null +++ b/js/src/tests/js1_5/Expressions/shell.js @@ -0,0 +1,103 @@ +/* -*- 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 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Date: 07 February 2001 + * + * Functionality common to Array testing - + */ +//----------------------------------------------------------------------------- + + +var CHAR_LBRACKET = '['; +var CHAR_RBRACKET = ']'; +var CHAR_QT_DBL = '"'; +var CHAR_QT = "'"; +var CHAR_NL = '\n'; +var CHAR_COMMA = ','; +var CHAR_SPACE = ' '; +var TYPE_STRING = typeof 'abc'; + + +/* + * If available, arr.toSource() gives more detail than arr.toString() + * + * var arr = Array(1,2,'3'); + * + * arr.toSource() + * [1, 2, "3"] + * + * arr.toString() + * 1,2,3 + * + * But toSource() doesn't exist in Rhino, so use our own imitation, below - + * + */ +function formatArray(arr) +{ + try + { + return arr.toSource(); + } + catch(e) + { + return toSource(arr); + } +} + + + +/* + * Imitate SpiderMonkey's arr.toSource() method: + * + * a) Double-quote each array element that is of string type + * b) Represent |undefined| and |null| by empty strings + * c) Delimit elements by a comma + single space + * d) Do not add delimiter at the end UNLESS the last element is |undefined| + * e) Add square brackets to the beginning and end of the string + */ +function toSource(arr) +{ + var delim = CHAR_COMMA + CHAR_SPACE; + var elt = ''; + var ret = ''; + var len = arr.length; + + for (i=0; i<len; i++) + { + elt = arr[i]; + + switch(true) + { + case (typeof elt === TYPE_STRING) : + ret += doubleQuote(elt); + break; + + case (elt === undefined || elt === null) : + break; // add nothing but the delimiter, below - + + default: + ret += elt.toString(); + } + + if ((i < len-1) || (elt === undefined)) + ret += delim; + } + + return CHAR_LBRACKET + ret + CHAR_RBRACKET; +} + + +function doubleQuote(text) +{ + return CHAR_QT_DBL + text + CHAR_QT_DBL; +} + + +function singleQuote(text) +{ + return CHAR_QT + text + CHAR_QT; +} + |