diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.11/11.11.2')
18 files changed, 522 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A1.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A1.js new file mode 100644 index 000000000..904d903e8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A1.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * White Space and Line Terminator between LogicalORExpression and "||" or between "||" and LogicalANDExpression are allowed + * + * @path ch11/11.11/11.11.2/S11.11.2_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if ((eval("false\u0009||\u0009true")) !== true) { + $ERROR('#1: (false\\u0009||\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("false\u000B||\u000Btrue")) !== true) { + $ERROR('#2: (false\\u000B||\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("false\u000C||\u000Ctrue")) !== true) { + $ERROR('#3: (false\\u000C||\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("false\u0020||\u0020true")) !== true) { + $ERROR('#4: (false\\u0020||\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("false\u00A0||\u00A0true")) !== true) { + $ERROR('#5: (false\\u00A0||\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("false\u000A||\u000Atrue")) !== true) { + $ERROR('#6: (false\\u000A||\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("false\u000D||\u000Dtrue")) !== true) { + $ERROR('#7: (false\\u000D||\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("false\u2028||\u2028true")) !== true) { + $ERROR('#8: (false\\u2028||\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("false\u2029||\u2029true")) !== true) { + $ERROR('#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) { + $ERROR('#10: (false\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029||\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T1.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T1.js new file mode 100644 index 000000000..2c79c2a5c --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * Operator x || y uses GetValue + * + * @path ch11/11.11/11.11.2/S11.11.2_A2.1_T1.js + * @description Either Type is not Reference or GetBase is not null + */ + +//CHECK#1 +if ((true || false) !== true) { + $ERROR('#1: (true || false) === true'); +} + +//CHECK#2 +if ((false || true) !== true) { + $ERROR('#2: (false || true) === true'); +} + +//CHECK#3 +var x = new Boolean(false); +if ((x || true) !== x) { + $ERROR('#3: var x = Boolean(false); (x || true) === x'); +} + +//CHECK#4 +var y = new Boolean(true); +if ((false || y) !== y) { + $ERROR('#4: var y = Boolean(true); (false || y) === y'); +} + +//CHECK#5 +var x = new Boolean(false); +var y = new Boolean(true); +if ((x || y) !== x) { + $ERROR('#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) { + $ERROR('#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) { + $ERROR('#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) { + $ERROR('#8: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1.1; objecty.prop = false; (objectx.prop || objecty.prop) === objectx.prop'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T2.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T2.js new file mode 100644 index 000000000..7c3e74364 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * Operator x || y uses GetValue + * + * @path ch11/11.11/11.11.2/S11.11.2_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x || true; + $ERROR('#1.1: x || true throw ReferenceError. Actual: ' + (x || true)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x || true throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T3.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T3.js new file mode 100644 index 000000000..1535d1ca6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_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. + +/** + * Operator x || y uses GetValue + * + * @path ch11/11.11/11.11.2/S11.11.2_A2.1_T3.js + * @description If ToBoolean(x) is false and GetBase(y) is null, throw ReferenceError + */ + +//CHECK#1 +try { + false || y; + $ERROR('#1.1: false || y throw ReferenceError. Actual: ' + (false || y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: false || y throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T4.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.1_T4.js new file mode 100644 index 000000000..47101ac90 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * Operator x || y uses GetValue + * + * @path ch11/11.11/11.11.2/S11.11.2_A2.1_T4.js + * @description If ToBoolean(x) is true and GetBase(y) is null, return true + */ + +//CHECK#1 +if ((true || x) !== true) { + $ERROR('#1: (true || x) === true'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.4_T1.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.4_T1.js new file mode 100644 index 000000000..fd60270da --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.11/11.11.2/S11.11.2_A2.4_T1.js + * @description Checking with "=" + */ + +//CHECK#1 +var x = true; +if (((x = false) || x) !== false) { + $ERROR('#1: var x = true; ((x = false) || x) === false'); +} + +//CHECK#2 +var x = true; +if ((x || (x = false)) !== true) { + $ERROR('#2: var x = true; (x || (x = false)) === true'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.4_T2.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.4_T2.js new file mode 100644 index 000000000..5d2ca6568 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.11/11.11.2/S11.11.2_A2.4_T2.js + * @description Checking with "throw" + */ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() || y(); + $ERROR('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() || y() throw "x". Actual: ' + (x() || y())); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() || y() throw "x". Actual: ' + (e)); + } + } +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.4_T3.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.4_T3.js new file mode 100644 index 000000000..c818312c8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A2.4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.11/11.11.2/S11.11.2_A2.4_T3.js + * @description Checking with undeclarated variables + * @noStrict + */ + +//CHECK#1 +try { + x || (x = true); + $ERROR('#1.1: x || (x = true) throw ReferenceError. Actual: ' + (x || (x = true))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x || (x = true) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if (((y = true) || y) !== true) { + $ERROR('#2: ((y = true) || y) === true'); +} + + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T1.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T1.js new file mode 100644 index 000000000..d03958565 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_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. + +/** + * If ToBoolean(x) is false, return y + * + * @path ch11/11.11/11.11.2/S11.11.2_A3_T1.js + * @description Type(x) and Type(y) vary between primitive boolean and Boolean object + */ + +//CHECK#1 +if ((false || true) !== true) { + $ERROR('#1: (false || true) === true'); +} + +//CHECK#2 +if ((false || false) !== false) { + $ERROR('#2: (false || false) === false'); +} + +//CHECK#3 +var y = new Boolean(true); +if ((false || y) !== y) { + $ERROR('#3: (var y = new Boolean(true); false || y) === y'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((false || y) !== y) { + $ERROR('#4: (var y = new Boolean(false); false || y) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T2.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T2.js new file mode 100644 index 000000000..dccc098d2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * If ToBoolean(x) is false, return y + * + * @path ch11/11.11/11.11.2/S11.11.2_A3_T2.js + * @description Type(x) and Type(y) vary between primitive number and Number object + */ + +//CHECK#1 +if ((0 || -0) !== 0) { + $ERROR('#1.1: (0 || -0) === 0'); +} else { + if ((1 / (0 || -0)) !== Number.NEGATIVE_INFINITY) { + $ERROR('#1.2: (0 || -0) === -0'); + } +} + +//CHECK#2 +if ((-0 || 0) !== 0) { + $ERROR('#2.1: (-0 || 0) === 0'); +} else { + if ((1 / (-0 || 0)) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: (-0 || 0) === +0'); + } +} + +//CHECK#3 +var y = new Number(-1); +if ((0 || y) !== y) { + $ERROR('#3: (var y = new Number(-1); 0 || y) === y'); +} + +//CHECK#4 +var y = new Number(0); +if ((NaN || y) !== y) { + $ERROR('#4: (var y = new Number(0); NaN || y) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T3.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T3.js new file mode 100644 index 000000000..6e500ede8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * If ToBoolean(x) is false, return y + * + * @path ch11/11.11/11.11.2/S11.11.2_A3_T3.js + * @description Type(x) and Type(y) vary between primitive string and String object + */ + +//CHECK#1 +if (("" || "1") !== "1") { + $ERROR('#1: ("" || "1") === "1"'); +} + +//CHECK#2 +var y = new String("1"); +if (("" || y) !== y) { + $ERROR('#2: (var y = new String("1"); "" || y) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T4.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A3_T4.js new file mode 100644 index 000000000..15b5579af --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * If ToBoolean(x) is false, return y + * + * @path ch11/11.11/11.11.2/S11.11.2_A3_T4.js + * @description Type(x) or Type(y) is changed between null and undefined + */ + +//CHECK#1 +if ((false || undefined) !== undefined) { + $ERROR('#1: (false || undefined) === undefined'); +} + +//CHECK#2 +if ((false || null) !== null) { + $ERROR('#2: (false || null) === null'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T1.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T1.js new file mode 100644 index 000000000..567fbf522 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T1.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. + +/** + * If ToBoolean(x) is true, return x + * + * @path ch11/11.11/11.11.2/S11.11.2_A4_T1.js + * @description Type(x) and Type(y) vary between primitive boolean and Boolean object + */ + +//CHECK#1 +if (((true || true)) !== true) { + $ERROR('#1: (true || true) === true'); +} + +//CHECK#2 +if ((true || false) !== true) { + $ERROR('#2: (true || false) === true'); +} + +//CHECK#3 +var x = new Boolean(true); +if ((x || new Boolean(true)) !== x) { + $ERROR('#3: (var x = new Boolean(true); (x || new Boolean(true)) === x'); +} + +//CHECK#4 +var x = new Boolean(true); +if ((x || new Boolean(false)) !== x) { + $ERROR('#4: (var x = new Boolean(true); (x || new Boolean(false)) === x'); +} + +//CHECK#5 +var x = new Boolean(false); +if ((x || new Boolean(true)) !== x) { + $ERROR('#5: (var x = new Boolean(false); (x || new Boolean(true)) === x'); +} + +//CHECK#6 +var x = new Boolean(false); +if ((x || new Boolean(false)) !== x) { + $ERROR('#6: (var x = new Boolean(false); (x || new Boolean(false)) === x'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T2.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T2.js new file mode 100644 index 000000000..ff3c67a64 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * If ToBoolean(x) is true, return x + * + * @path ch11/11.11/11.11.2/S11.11.2_A4_T2.js + * @description Type(x) and Type(y) vary between primitive number and Number object + */ + +//CHECK#1 +if ((-1 || 1) !== -1) { + $ERROR('#1: (-1 || 1) === -1'); +} + +//CHECK#2 +if ((1 || new Number(0)) !== 1) { + $ERROR('#2: (1 || new Number(0)) === 1'); +} + +//CHECK#3 +if ((-1 || NaN) !== -1) { + $ERROR('#3: (-1 || NaN) === -1'); +} + +//CHECK#4 +var x = new Number(-1); +if ((x || new Number(0)) !== x) { + $ERROR('#4: (var x = new Number(-1); (x || new Number(-1)) === x'); +} + +//CHECK#5 +var x = new Number(NaN); +if ((x || new Number(1)) !== x) { + $ERROR('#5: (var x = new Number(NaN); (x || new Number(1)) === x'); +} + +//CHECK#6 +var x = new Number(0); +if ((x || new Number(NaN)) !== x) { + $ERROR('#6: (var x = new Number(0); (x || new Number(NaN)) === x'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T3.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T3.js new file mode 100644 index 000000000..ad71dfed7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * If ToBoolean(x) is true, return x + * + * @path ch11/11.11/11.11.2/S11.11.2_A4_T3.js + * @description Type(x) and Type(y) vary between primitive string and String object + */ + +//CHECK#1 +if (("-1" || "1") !== "-1") { + $ERROR('#-1: ("-1" || "1") === "-1"'); +} + +//CHECK#2 +if (("-1" || "x") !== "-1") { + $ERROR('#2: ("-1" || "x") === "-1"'); +} + +//CHECK#3 +var x = new String("-1"); +if ((x || new String(-1)) !== x) { + $ERROR('#3: (var x = new String("-1"); (x || new String(-1)) === x'); +} + +//CHECK#4 +var x = new String(NaN); +if ((x || new String("1")) !== x) { + $ERROR('#4: (var x = new String(NaN); (x || new String("1")) === x'); +} + +//CHECK#5 +var x = new String("-x"); +if ((x || new String("x")) !== x) { + $ERROR('#5: (var x = new String("-x"); (x || new String("x")) === x'); +} + +//CHECK#6 +var x = new String(0); +if ((x || new String(NaN)) !== x) { + $ERROR('#6: (var x = new String(0); (x || new String(NaN)) === x'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T4.js b/js/src/tests/test262/ch11/11.11/11.11.2/S11.11.2_A4_T4.js new file mode 100644 index 000000000..d37b2ea59 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/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. + +/** + * If ToBoolean(x) is true, return x + * + * @path ch11/11.11/11.11.2/S11.11.2_A4_T4.js + * @description Type(x) or Type(y) vary between Null and Undefined + */ + +//CHECK#1 +if ((true || undefined) !== true) { + $ERROR('#1: (true || undefined) === true'); +} + +//CHECK#2 +if ((true || null) !== true) { + $ERROR('#2: (true || null) === true'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/browser.js b/js/src/tests/test262/ch11/11.11/11.11.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/browser.js diff --git a/js/src/tests/test262/ch11/11.11/11.11.2/shell.js b/js/src/tests/test262/ch11/11.11/11.11.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.2/shell.js |