diff options
Diffstat (limited to 'js/src/tests/test262/language/expressions/logical-or')
20 files changed, 566 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A1.js new file mode 100644 index 0000000000..caa856412e --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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 LogicalORExpression and "||" or + between "||" and LogicalANDExpression are allowed +es5id: 11.11.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if ((eval("false\u0009||\u0009true")) !== true) { + throw new Test262Error('#1: (false\\u0009||\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("false\u000B||\u000Btrue")) !== true) { + throw new Test262Error('#2: (false\\u000B||\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("false\u000C||\u000Ctrue")) !== true) { + throw new Test262Error('#3: (false\\u000C||\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("false\u0020||\u0020true")) !== true) { + throw new Test262Error('#4: (false\\u0020||\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("false\u00A0||\u00A0true")) !== true) { + throw new Test262Error('#5: (false\\u00A0||\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("false\u000A||\u000Atrue")) !== true) { + throw new Test262Error('#6: (false\\u000A||\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("false\u000D||\u000Dtrue")) !== true) { + throw new Test262Error('#7: (false\\u000D||\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("false\u2028||\u2028true")) !== true) { + throw new Test262Error('#8: (false\\u2028||\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("false\u2029||\u2029true")) !== true) { + throw new Test262Error('#9: (false\\u2029||\\u2029true) === true'); +} + + +//CHECK#10 +if ((eval("false\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029||\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) { + throw new Test262Error('#10: (false\\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-or/S11.11.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T1.js new file mode 100644 index 0000000000..48d6e5d961 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((true || false) !== true) { + throw new Test262Error('#1: (true || false) === true'); +} + +//CHECK#2 +if ((false || true) !== true) { + throw new Test262Error('#2: (false || true) === true'); +} + +//CHECK#3 +var x = new Boolean(false); +if ((x || true) !== x) { + throw new Test262Error('#3: var x = Boolean(false); (x || true) === x'); +} + +//CHECK#4 +var y = new Boolean(true); +if ((false || y) !== y) { + throw new Test262Error('#4: var y = Boolean(true); (false || y) === y'); +} + +//CHECK#5 +var x = new Boolean(false); +var y = new Boolean(true); +if ((x || y) !== x) { + throw new Test262Error('#5: var x = new Boolean(false); var y = new Boolean(true); (x || y) === x'); +} + +//CHECK#6 +var x = false; +var y = new Boolean(true); +if ((x || y) !== y) { + throw new Test262Error('#6: var x = false; var y = new Boolean(true); (x || y) === y'); +} + +//CHECK#7 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = false; +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 = false; objecty.prop = 1; (objectx.prop || objecty.prop) === objecty.prop'); +} + +//CHECK#8 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1.1; +objecty.prop = false; +if ((objectx.prop || objecty.prop) !== objectx.prop) { + throw new Test262Error('#8: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1.1; objecty.prop = false; (objectx.prop || objecty.prop) === objectx.prop'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T2.js new file mode 100644 index 0000000000..51aac7879e --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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.2_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-or/S11.11.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T3.js new file mode 100644 index 0000000000..4b448a86cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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.2_A2.1_T3 +description: > + If ToBoolean(x) is false and GetBase(y) is null, throw + ReferenceError +---*/ + +//CHECK#1 +try { + false || y; + throw new Test262Error('#1.1: false || y throw ReferenceError. Actual: ' + (false || y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: false || y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T4.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T4.js new file mode 100644 index 0000000000..a924d7b933 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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.2_A2.1_T4 +description: If ToBoolean(x) is true and GetBase(y) is null, return true +---*/ + +//CHECK#1 +if ((true || x) !== true) { + throw new Test262Error('#1: (true || x) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T1.js new file mode 100644 index 0000000000..bbeaf4902b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = true; +if (((x = false) || x) !== false) { + throw new Test262Error('#1: var x = true; ((x = false) || x) === false'); +} + +//CHECK#2 +var x = true; +if ((x || (x = false)) !== true) { + throw new Test262Error('#2: var x = true; (x || (x = false)) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T2.js new file mode 100644 index 0000000000..f86dd21c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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.2_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-or/S11.11.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T3.js new file mode 100644 index 0000000000..536e682860 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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.2_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-or/S11.11.2_A3_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T1.js new file mode 100644 index 0000000000..c6200ed305 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T1.js @@ -0,0 +1,34 @@ +// 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 y +es5id: 11.11.2_A3_T1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if ((false || true) !== true) { + throw new Test262Error('#1: (false || true) === true'); +} + +//CHECK#2 +if ((false || false) !== false) { + throw new Test262Error('#2: (false || false) === false'); +} + +//CHECK#3 +var y = new Boolean(true); +if ((false || y) !== y) { + throw new Test262Error('#3: (var y = new Boolean(true); false || y) === y'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((false || y) !== y) { + throw new Test262Error('#4: (var y = new Boolean(false); false || y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T2.js new file mode 100644 index 0000000000..f0db72dbcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T2.js @@ -0,0 +1,40 @@ +// 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 y +es5id: 11.11.2_A3_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((0 || -0) !== 0) { + throw new Test262Error('#1.1: (0 || -0) === 0'); +} else { + if ((1 / (0 || -0)) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: (0 || -0) === -0'); + } +} + +//CHECK#2 +if ((-0 || 0) !== 0) { + throw new Test262Error('#2.1: (-0 || 0) === 0'); +} else { + if ((1 / (-0 || 0)) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (-0 || 0) === +0'); + } +} + +//CHECK#3 +var y = new Number(-1); +if ((0 || y) !== y) { + throw new Test262Error('#3: (var y = new Number(-1); 0 || y) === y'); +} + +//CHECK#4 +var y = new Number(0); +if ((NaN || y) !== y) { + throw new Test262Error('#4: (var y = new Number(0); NaN || y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T3.js new file mode 100644 index 0000000000..20928072cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T3.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: If ToBoolean(x) is false, return y +es5id: 11.11.2_A3_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("" || "1") !== "1") { + throw new Test262Error('#1: ("" || "1") === "1"'); +} + +//CHECK#2 +var y = new String("1"); +if (("" || y) !== y) { + throw new Test262Error('#2: (var y = new String("1"); "" || y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T4.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T4.js new file mode 100644 index 0000000000..a117545599 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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 y +es5id: 11.11.2_A3_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((false || undefined) !== undefined) { + throw new Test262Error('#1: (false || undefined) === undefined'); +} + +//CHECK#2 +if ((false || null) !== null) { + throw new Test262Error('#2: (false || null) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T1.js new file mode 100644 index 0000000000..63818db8e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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 x +es5id: 11.11.2_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) !== true) { + throw new Test262Error('#2: (true || false) === true'); +} + +//CHECK#3 +var x = new Boolean(true); +if ((x || new Boolean(true)) !== x) { + throw new Test262Error('#3: (var x = new Boolean(true); (x || new Boolean(true)) === x'); +} + +//CHECK#4 +var x = new Boolean(true); +if ((x || new Boolean(false)) !== x) { + throw new Test262Error('#4: (var x = new Boolean(true); (x || new Boolean(false)) === x'); +} + +//CHECK#5 +var x = new Boolean(false); +if ((x || new Boolean(true)) !== x) { + throw new Test262Error('#5: (var x = new Boolean(false); (x || new Boolean(true)) === x'); +} + +//CHECK#6 +var x = new Boolean(false); +if ((x || new Boolean(false)) !== x) { + throw new Test262Error('#6: (var x = new Boolean(false); (x || new Boolean(false)) === x'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T2.js new file mode 100644 index 0000000000..272e94024c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T2.js @@ -0,0 +1,43 @@ +// 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 x +es5id: 11.11.2_A4_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((-1 || 1) !== -1) { + throw new Test262Error('#1: (-1 || 1) === -1'); +} + +//CHECK#2 +if ((1 || new Number(0)) !== 1) { + throw new Test262Error('#2: (1 || new Number(0)) === 1'); +} + +//CHECK#3 +if ((-1 || NaN) !== -1) { + throw new Test262Error('#3: (-1 || NaN) === -1'); +} + +//CHECK#4 +var x = new Number(-1); +if ((x || new Number(0)) !== x) { + throw new Test262Error('#4: (var x = new Number(-1); (x || new Number(-1)) === x'); +} + +//CHECK#5 +var x = new Number(NaN); +if ((x || new Number(1)) !== x) { + throw new Test262Error('#5: (var x = new Number(NaN); (x || new Number(1)) === x'); +} + +//CHECK#6 +var x = new Number(0); +if ((x || new Number(NaN)) !== x) { + throw new Test262Error('#6: (var x = new Number(0); (x || new Number(NaN)) === x'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T3.js new file mode 100644 index 0000000000..8a8f80a86a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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 x +es5id: 11.11.2_A4_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("-1" || "1") !== "-1") { + throw new Test262Error('#-1: ("-1" || "1") === "-1"'); +} + +//CHECK#2 +if (("-1" || "x") !== "-1") { + throw new Test262Error('#2: ("-1" || "x") === "-1"'); +} + +//CHECK#3 +var x = new String("-1"); +if ((x || new String(-1)) !== x) { + throw new Test262Error('#3: (var x = new String("-1"); (x || new String(-1)) === x'); +} + +//CHECK#4 +var x = new String(NaN); +if ((x || new String("1")) !== x) { + throw new Test262Error('#4: (var x = new String(NaN); (x || new String("1")) === x'); +} + +//CHECK#5 +var x = new String("-x"); +if ((x || new String("x")) !== x) { + throw new Test262Error('#5: (var x = new String("-x"); (x || new String("x")) === x'); +} + +//CHECK#6 +var x = new String(0); +if ((x || new String(NaN)) !== x) { + throw new Test262Error('#6: (var x = new String(0); (x || new String(NaN)) === x'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T4.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T4.js new file mode 100644 index 0000000000..782faad38c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_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 x +es5id: 11.11.2_A4_T4 +description: Type(x) or Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if ((true || undefined) !== true) { + throw new Test262Error('#1: (true || undefined) === true'); +} + +//CHECK#2 +if ((true || null) !== true) { + throw new Test262Error('#2: (true || null) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/browser.js b/js/src/tests/test262/language/expressions/logical-or/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/browser.js diff --git a/js/src/tests/test262/language/expressions/logical-or/shell.js b/js/src/tests/test262/language/expressions/logical-or/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/shell.js diff --git a/js/src/tests/test262/language/expressions/logical-or/symbol-logical-or-evaluation.js b/js/src/tests/test262/language/expressions/logical-or/symbol-logical-or-evaluation.js new file mode 100644 index 0000000000..7b5e765188 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/symbol-logical-or-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 OR" Symbol evaluation +features: [Symbol] +---*/ +var sym = Symbol(); + +assert.sameValue(!sym || true, true, "`!sym || true` is `true`"); +assert.sameValue(sym || false, sym, "`sym || false` is `sym`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/tco-right-strict.js b/js/src/tests/test262/language/expressions/logical-or/tco-right-strict.js new file mode 100644 index 0000000000..0bb70f0143 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/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 false || f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); |