diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/expressions/logical-and | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/logical-and')
20 files changed, 564 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A1.js new file mode 100644 index 0000000000..d52841641b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LogicalANDExpression and "&&" or + between "&&" and BitwiseORExpression are allowed +es5id: 11.11.1_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if ((eval("true\u0009&&\u0009true")) !== true) { + throw new Test262Error('#1: (true\\u0009&&\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("true\u000B&&\u000Btrue")) !== true) { + throw new Test262Error('#2: (true\\u000B&&\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("true\u000C&&\u000Ctrue")) !== true) { + throw new Test262Error('#3: (true\\u000C&&\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("true\u0020&&\u0020true")) !== true) { + throw new Test262Error('#4: (true\\u0020&&\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("true\u00A0&&\u00A0true")) !== true) { + throw new Test262Error('#5: (true\\u00A0&&\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("true\u000A&&\u000Atrue")) !== true) { + throw new Test262Error('#6: (true\\u000A&&\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("true\u000D&&\u000Dtrue")) !== true) { + throw new Test262Error('#7: (true\\u000D&&\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("true\u2028&&\u2028true")) !== true) { + throw new Test262Error('#8: (true\\u2028&&\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("true\u2029&&\u2029true")) !== true) { + throw new Test262Error('#9: (true\\u2029&&\\u2029true) === true'); +} + + +//CHECK#10 +if ((eval("true\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029&&\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) { + throw new Test262Error('#10: (true\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029&&\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T1.js new file mode 100644 index 0000000000..0bb7dc4c78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T1.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((false && true) !== false) { + throw new Test262Error('#1: (false && true) === false'); +} + +//CHECK#2 +if ((true && false) !== false) { + throw new Test262Error('#2: (true && false) === false'); +} + +//CHECK#3 +var x = false; +if ((x && true) !== false) { + throw new Test262Error('#3: var x = false; (x && true) === false'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((true && y) !== y) { + throw new Test262Error('#4: var y = new Boolean(false); (true && y) === y'); +} + +//CHECK#5 +var x = false; +var y = true; +if ((x && y) !== false) { + throw new Test262Error('#5: var x = false; var y = true; (x && y) === false'); +} + +//CHECK#6 +var x = true; +var y = new Boolean(false); +if ((x && y) !== y) { + throw new Test262Error('#6: var x = true; var y = new Boolean(false); (x && y) === y'); +} + +//CHECK#7 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = true; +objecty.prop = 1.1; +if ((objectx.prop && objecty.prop) !== objecty.prop) { + throw new Test262Error('#7: var objectx = new Object(); var objecty = new Object(); objectx.prop = true; objecty.prop = 1; (objectx.prop && objecty.prop) === objecty.prop'); +} + +//CHECK#8 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 0; +objecty.prop = true; +if ((objectx.prop && objecty.prop) !== objectx.prop) { + throw new Test262Error('#8: var objectx = new Object(); var objecty = new Object(); objectx.prop = 0; objecty.prop = true; (objectx.prop && objecty.prop) === objectx.prop'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T2.js new file mode 100644 index 0000000000..5fc58c4986 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x && true; + throw new Test262Error('#1.1: x && true throw ReferenceError. Actual: ' + (x && true)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x && true throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T3.js new file mode 100644 index 0000000000..81ad311406 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T3 +description: > + If ToBoolean(x) is true and GetBase(y) is null, throw + ReferenceError +---*/ + +//CHECK#1 +try { + true && y; + throw new Test262Error('#1.1: true && y throw ReferenceError. Actual: ' + (true && y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: true && y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T4.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T4.js new file mode 100644 index 0000000000..07df92a28a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T4.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T4 +description: If ToBoolean(x) is false and GetBase(y) is null, return false +---*/ + +//CHECK#1 +if ((false && x) !== false) { + throw new Test262Error('#1: (false && x) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T1.js new file mode 100644 index 0000000000..66bbb4150c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = false; +if (((x = true) && x) !== true) { + throw new Test262Error('#1: var x = false; ((x = true) && x) === true'); +} + +//CHECK#2 +var x = false; +if ((x && (x = true)) !== false) { + throw new Test262Error('#2: var x = false; (x && (x = true)) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T2.js new file mode 100644 index 0000000000..5916178650 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() && y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() && y() throw "x". Actual: ' + (x() && y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() && y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T3.js new file mode 100644 index 0000000000..07ce5795bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.1_A2.4_T3 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +try { + x && (x = true); + throw new Test262Error('#1.1: x && (x = true) throw ReferenceError. Actual: ' + (x && (x = true))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x && (x = true) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if (((y = true) && y) !== true) { + throw new Test262Error('#2: ((y = true) && y) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T1.js new file mode 100644 index 0000000000..67e5e7642a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T1 +description: > + Type(x) is primitive boolean and Type(y) is changed between + primitive boolean and Boolean object +---*/ + +//CHECK#1 +if ((false && true) !== false) { + throw new Test262Error('#1: (false && true) === false'); +} + +//CHECK#2 +if ((false && false) !== false) { + throw new Test262Error('#2: (false && false) === false'); +} + +//CHECK#3 +if ((false && new Boolean(true)) !== false) { + throw new Test262Error('#3: (false && new Boolean(true)) === false'); +} + +//CHECK#4 +if ((false && new Boolean(false)) !== false) { + throw new Test262Error('#4: (false && new Boolean(false)) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T2.js new file mode 100644 index 0000000000..254b02785c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((-0 && -1) !== 0) { + throw new Test262Error('#1.1: (-0 && -1) === 0'); +} else { + if ((1 / (-0 && -1)) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: (-0 && -1) === -0'); + } +} + +//CHECK#2 +if ((0 && new Number(-1)) !== 0) { + throw new Test262Error('#2.1: (0 && new Number(-1)) === 0'); +} else { + if ((1 / (0 && new Number(-1))) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (0 && new Number(-1)) === +0'); + } +} + +//CHECK#3 +if ((isNaN(NaN && 1)) !== true) { + throw new Test262Error('#3: (NaN && 1) === Not-a-Number'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T3.js new file mode 100644 index 0000000000..c16aa63aea --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("" && "1") !== "") { + throw new Test262Error('#1: ("" && "1") === ""'); +} + +//CHECK#2 +if (("" && new String("1")) !== "") { + throw new Test262Error('#2: ("" && new String("1")) === ""'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T4.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T4.js new file mode 100644 index 0000000000..e9274ae612 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((undefined && true) !== undefined) { + throw new Test262Error('#1: (undefined && true) === undefined'); +} + +//CHECK#2 +if ((null && false) !== null) { + throw new Test262Error('#2: (null && false) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T1.js new file mode 100644 index 0000000000..1018d63a9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if ((true && true) !== true) { + throw new Test262Error('#1: (true && true) === true'); +} + +//CHECK#2 +if ((true && false) !== false) { + throw new Test262Error('#2: (true && false) === false'); +} + +//CHECK#3 +var y = new Boolean(true); +if ((new Boolean(true) && y) !== y) { + throw new Test262Error('#3: (var y = new Boolean(true); (new Boolean(true) && y) === y'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((new Boolean(true) && y) !== y) { + throw new Test262Error('#4: (var y = new Boolean(false); (new Boolean(true) && y) === y'); +} + +//CHECK#5 +var y = new Boolean(true); +if ((new Boolean(false) && y) !== y) { + throw new Test262Error('#5: (var y = new Boolean(true); (new Boolean(false) && y) === y'); +} + +//CHECK#6 +var y = new Boolean(false); +if ((new Boolean(false) && y) !== y) { + throw new Test262Error('#6: (var y = new Boolean(false); (new Boolean(false) && y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T2.js new file mode 100644 index 0000000000..b370c3ffae --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T2.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((-1 && -0) !== 0) { + throw new Test262Error('#1.1: (-1 && -0) === 0'); +} else { + if ((1 / (-1 && -0)) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: (-1 && -0) === -0'); + } +} + +//CHECK#2 +if ((-1 && 0) !== 0) { + throw new Test262Error('#2.1: (-1 && 0) === 0'); +} else { + if ((1 / (-1 && 0)) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (-1 && 0) === +0'); + } +} + +//CHECK#3 +if ((isNaN(0.1 && NaN)) !== true) { + throw new Test262Error('#3: (0.1 && NaN) === Not-a-Number'); +} + +//CHECK#4 +var y = new Number(0); +if ((new Number(-1) && y) !== y) { + throw new Test262Error('#4: (var y = new Number(0); (new Number(-1) && y) === y'); +} + +//CHECK#5 +var y = new Number(NaN); +if ((new Number(0) && y) !== y) { + throw new Test262Error('#5: (var y = new Number(NaN); (new Number(0) && y) === y'); +} + +//CHECK#6 +var y = new Number(-1); +if ((new Number(NaN) && y) !== y) { + throw new Test262Error('#6: (var y = new Number(-1); (new Number(NaN) && y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T3.js new file mode 100644 index 0000000000..ebd38af02b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T3.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("0" && "-1") !== "-1") { + throw new Test262Error('#-1: ("0" && "-1") === "-1"'); +} + +//CHECK#2 +if (("-1" && "x") !== "x") { + throw new Test262Error('#2: ("-1" && "x") === "x"'); +} + +//CHECK#3 +var y = new String(-1); +if ((new String("-1") && y) !== y) { + throw new Test262Error('#3: (var y = new String(-1); (new String("-1") && y) === y'); +} + +//CHECK#4 +var y = new String(NaN); +if ((new String("0") && y) !== y) { + throw new Test262Error('#4: (var y = new String(NaN); (new String("0") && y) === y'); +} + +//CHECK#5 +var y = new String("-x"); +if ((new String("x") && y) !== y) { + throw new Test262Error('#5: (var y = new String("-x"); (new String("x") && y) === y'); +} + +//CHECK#6 +var y = new String(-1); +if ((new String(NaN) && y) !== y) { + throw new Test262Error('#6: (var y = new String(-1); (new String(NaN) && y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T4.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T4.js new file mode 100644 index 0000000000..7c984e035f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((true && undefined) !== undefined) { + throw new Test262Error('#1: (true && undefined) === undefined'); +} + +//CHECK#2 +if ((true && null) !== null) { + throw new Test262Error('#2: (true && null) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/browser.js b/js/src/tests/test262/language/expressions/logical-and/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/browser.js diff --git a/js/src/tests/test262/language/expressions/logical-and/shell.js b/js/src/tests/test262/language/expressions/logical-and/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/shell.js diff --git a/js/src/tests/test262/language/expressions/logical-and/symbol-logical-and-evaluation.js b/js/src/tests/test262/language/expressions/logical-and/symbol-logical-and-evaluation.js new file mode 100644 index 0000000000..50698549f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/symbol-logical-and-evaluation.js @@ -0,0 +1,14 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.12.3 +description: > + "Logical AND" Symbol evaluation +features: [Symbol] +---*/ +var sym = Symbol(); + +assert.sameValue(sym && true, true, "`sym && true` is `true`"); +assert.sameValue(!sym && false, false, "`!sym && false` is `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/tco-right-strict.js b/js/src/tests/test262/language/expressions/logical-and/tco-right-strict.js new file mode 100644 index 0000000000..23e1590fda --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/tco-right-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return true && f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); |