diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.11')
38 files changed, 1043 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A1.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A1.js new file mode 100644 index 000000000..71ff7400e --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_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 LogicalANDExpression and "&&" or between "&&" and BitwiseORExpression are allowed + * + * @path ch11/11.11/11.11.1/S11.11.1_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if ((eval("true\u0009&&\u0009true")) !== true) { + $ERROR('#1: (true\\u0009&&\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("true\u000B&&\u000Btrue")) !== true) { + $ERROR('#2: (true\\u000B&&\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("true\u000C&&\u000Ctrue")) !== true) { + $ERROR('#3: (true\\u000C&&\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("true\u0020&&\u0020true")) !== true) { + $ERROR('#4: (true\\u0020&&\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("true\u00A0&&\u00A0true")) !== true) { + $ERROR('#5: (true\\u00A0&&\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("true\u000A&&\u000Atrue")) !== true) { + $ERROR('#6: (true\\u000A&&\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("true\u000D&&\u000Dtrue")) !== true) { + $ERROR('#7: (true\\u000D&&\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("true\u2028&&\u2028true")) !== true) { + $ERROR('#8: (true\\u2028&&\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("true\u2029&&\u2029true")) !== true) { + $ERROR('#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) { + $ERROR('#10: (true\\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.1/S11.11.1_A2.1_T1.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.1_T1.js new file mode 100644 index 000000000..f637f4d73 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * Operator x && y uses GetValue + * + * @path ch11/11.11/11.11.1/S11.11.1_A2.1_T1.js + * @description Either Type is not Reference or GetBase is not null + */ + +//CHECK#1 +if ((false && true) !== false) { + $ERROR('#1: (false && true) === false'); +} + +//CHECK#2 +if ((true && false) !== false) { + $ERROR('#2: (true && false) === false'); +} + +//CHECK#3 +var x = false; +if ((x && true) !== false) { + $ERROR('#3: var x = false; (x && true) === false'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((true && y) !== y) { + $ERROR('#4: var y = new Boolean(false); (true && y) === y'); +} + +//CHECK#5 +var x = false; +var y = true; +if ((x && y) !== false) { + $ERROR('#5: var x = false; var y = true; (x && y) === false'); +} + +//CHECK#6 +var x = true; +var y = new Boolean(false); +if ((x && y) !== y) { + $ERROR('#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) { + $ERROR('#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) { + $ERROR('#8: var objectx = new Object(); var objecty = new Object(); objectx.prop = 0; objecty.prop = true; (objectx.prop && objecty.prop) === objectx.prop'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.1_T2.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.1_T2.js new file mode 100644 index 000000000..3c3585d1e --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * Operator x && y uses GetValue + * + * @path ch11/11.11/11.11.1/S11.11.1_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.1/S11.11.1_A2.1_T3.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.1_T3.js new file mode 100644 index 000000000..65eb292aa --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_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.1/S11.11.1_A2.1_T3.js + * @description If ToBoolean(x) is true and GetBase(y) is null, throw ReferenceError + */ + +//CHECK#1 +try { + true && y; + $ERROR('#1.1: true && y throw ReferenceError. Actual: ' + (true && y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: true && y throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.1_T4.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.1_T4.js new file mode 100644 index 000000000..e58d74ed2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * Operator x && y uses GetValue + * + * @path ch11/11.11/11.11.1/S11.11.1_A2.1_T4.js + * @description If ToBoolean(x) is false and GetBase(y) is null, return false + */ + +//CHECK#1 +if ((false && x) !== false) { + $ERROR('#1: (false && x) === false'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.4_T1.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.4_T1.js new file mode 100644 index 000000000..44fad0ce8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.4_T1.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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.11/11.11.1/S11.11.1_A2.4_T1.js + * @description Checking with "=" + */ + +//CHECK#1 +var x = false; +if (((x = true) && x) !== true) { + $ERROR('#1: var x = false; ((x = true) && x) === true'); +} + +//CHECK#2 +var x = false; +if ((x && (x = true)) !== false) { + $ERROR('#2: var x = false; (x && (x = true)) === false'); +} + + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.4_T2.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.4_T2.js new file mode 100644 index 000000000..b5efeee14 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * First expression is evaluated first, and then second expression + * + * @path ch11/11.11/11.11.1/S11.11.1_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.1/S11.11.1_A2.4_T3.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A2.4_T3.js new file mode 100644 index 000000000..cf973f0ff --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_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.1/S11.11.1_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.1/S11.11.1_A3_T1.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T1.js new file mode 100644 index 000000000..8274f3c61 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T1.js @@ -0,0 +1,30 @@ +// 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 x + * + * @path ch11/11.11/11.11.1/S11.11.1_A3_T1.js + * @description Type(x) is primitive boolean and Type(y) is changed between primitive boolean and Boolean object + */ + +//CHECK#1 +if ((false && true) !== false) { + $ERROR('#1: (false && true) === false'); +} + +//CHECK#2 +if ((false && false) !== false) { + $ERROR('#2: (false && false) === false'); +} + +//CHECK#3 +if ((false && new Boolean(true)) !== false) { + $ERROR('#3: (false && new Boolean(true)) === false'); +} + +//CHECK#4 +if ((false && new Boolean(false)) !== false) { + $ERROR('#4: (false && new Boolean(false)) === false'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T2.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T2.js new file mode 100644 index 000000000..01d206b5e --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * If ToBoolean(x) is false, return x + * + * @path ch11/11.11/11.11.1/S11.11.1_A3_T2.js + * @description Type(x) and Type(y) vary between primitive number and Number object + */ + +//CHECK#1 +if ((-0 && -1) !== 0) { + $ERROR('#1.1: (-0 && -1) === 0'); +} else { + if ((1 / (-0 && -1)) !== Number.NEGATIVE_INFINITY) { + $ERROR('#1.2: (-0 && -1) === -0'); + } +} + +//CHECK#2 +if ((0 && new Number(-1)) !== 0) { + $ERROR('#2.1: (0 && new Number(-1)) === 0'); +} else { + if ((1 / (0 && new Number(-1))) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: (0 && new Number(-1)) === +0'); + } +} + +//CHECK#3 +if ((isNaN(NaN && 1)) !== true) { + $ERROR('#3: (NaN && 1) === Not-a-Number'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T3.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T3.js new file mode 100644 index 000000000..034f9e2d8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * If ToBoolean(x) is false, return x + * + * @path ch11/11.11/11.11.1/S11.11.1_A3_T3.js + * @description Type(x) and Type(y) vary between primitive string and String object + */ + +//CHECK#1 +if (("" && "1") !== "") { + $ERROR('#1: ("" && "1") === ""'); +} + +//CHECK#2 +if (("" && new String("1")) !== "") { + $ERROR('#2: ("" && new String("1")) === ""'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T4.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A3_T4.js new file mode 100644 index 000000000..1a10a4ce4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * If ToBoolean(x) is false, return x + * + * @path ch11/11.11/11.11.1/S11.11.1_A3_T4.js + * @description Type(x) or Type(y) is changed between null and undefined + */ + +//CHECK#1 +if ((undefined && true) !== undefined) { + $ERROR('#1: (undefined && true) === undefined'); +} + +//CHECK#2 +if ((null && false) !== null) { + $ERROR('#2: (null && false) === null'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T1.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T1.js new file mode 100644 index 000000000..82f45be1f --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_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 y + * + * @path ch11/11.11/11.11.1/S11.11.1_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) !== false) { + $ERROR('#2: (true && false) === false'); +} + +//CHECK#3 +var y = new Boolean(true); +if ((new Boolean(true) && y) !== y) { + $ERROR('#3: (var y = new Boolean(true); (new Boolean(true) && y) === y'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((new Boolean(true) && y) !== y) { + $ERROR('#4: (var y = new Boolean(false); (new Boolean(true) && y) === y'); +} + +//CHECK#5 +var y = new Boolean(true); +if ((new Boolean(false) && y) !== y) { + $ERROR('#5: (var y = new Boolean(true); (new Boolean(false) && y) === y'); +} + +//CHECK#6 +var y = new Boolean(false); +if ((new Boolean(false) && y) !== y) { + $ERROR('#6: (var y = new Boolean(false); (new Boolean(false) && y) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T2.js new file mode 100644 index 000000000..5aaea6dce --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * If ToBoolean(x) is true, return y + * + * @path ch11/11.11/11.11.1/S11.11.1_A4_T2.js + * @description Type(x) and Type(y) vary between primitive number and Number object + */ + +//CHECK#1 +if ((-1 && -0) !== 0) { + $ERROR('#1.1: (-1 && -0) === 0'); +} else { + if ((1 / (-1 && -0)) !== Number.NEGATIVE_INFINITY) { + $ERROR('#1.2: (-1 && -0) === -0'); + } +} + +//CHECK#2 +if ((-1 && 0) !== 0) { + $ERROR('#2.1: (-1 && 0) === 0'); +} else { + if ((1 / (-1 && 0)) !== Number.POSITIVE_INFINITY) { + $ERROR('#2.2: (-1 && 0) === +0'); + } +} + +//CHECK#3 +if ((isNaN(0.1 && NaN)) !== true) { + $ERROR('#3: (0.1 && NaN) === Not-a-Number'); +} + +//CHECK#4 +var y = new Number(0); +if ((new Number(-1) && y) !== y) { + $ERROR('#4: (var y = new Number(0); (new Number(-1) && y) === y'); +} + +//CHECK#5 +var y = new Number(NaN); +if ((new Number(0) && y) !== y) { + $ERROR('#5: (var y = new Number(NaN); (new Number(0) && y) === y'); +} + +//CHECK#6 +var y = new Number(-1); +if ((new Number(NaN) && y) !== y) { + $ERROR('#6: (var y = new Number(-1); (new Number(NaN) && y) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T3.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T3.js new file mode 100644 index 000000000..1ae1808d1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * If ToBoolean(x) is true, return y + * + * @path ch11/11.11/11.11.1/S11.11.1_A4_T3.js + * @description Type(x) and Type(y) vary between primitive string and String object + */ + +//CHECK#1 +if (("0" && "-1") !== "-1") { + $ERROR('#-1: ("0" && "-1") === "-1"'); +} + +//CHECK#2 +if (("-1" && "x") !== "x") { + $ERROR('#2: ("-1" && "x") === "x"'); +} + +//CHECK#3 +var y = new String(-1); +if ((new String("-1") && y) !== y) { + $ERROR('#3: (var y = new String(-1); (new String("-1") && y) === y'); +} + +//CHECK#4 +var y = new String(NaN); +if ((new String("0") && y) !== y) { + $ERROR('#4: (var y = new String(NaN); (new String("0") && y) === y'); +} + +//CHECK#5 +var y = new String("-x"); +if ((new String("x") && y) !== y) { + $ERROR('#5: (var y = new String("-x"); (new String("x") && y) === y'); +} + +//CHECK#6 +var y = new String(-1); +if ((new String(NaN) && y) !== y) { + $ERROR('#6: (var y = new String(-1); (new String(NaN) && y) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T4.js b/js/src/tests/test262/ch11/11.11/11.11.1/S11.11.1_A4_T4.js new file mode 100644 index 000000000..109744386 --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/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. + +/** + * If ToBoolean(x) is true, return y + * + * @path ch11/11.11/11.11.1/S11.11.1_A4_T4.js + * @description Type(x) or Type(y) is changed between null and undefined + */ + +//CHECK#1 +if ((true && undefined) !== undefined) { + $ERROR('#1: (true && undefined) === undefined'); +} + +//CHECK#2 +if ((true && null) !== null) { + $ERROR('#2: (true && null) === null'); +} + diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/browser.js b/js/src/tests/test262/ch11/11.11/11.11.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/browser.js diff --git a/js/src/tests/test262/ch11/11.11/11.11.1/shell.js b/js/src/tests/test262/ch11/11.11/11.11.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/11.11.1/shell.js 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 diff --git a/js/src/tests/test262/ch11/11.11/browser.js b/js/src/tests/test262/ch11/11.11/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/browser.js diff --git a/js/src/tests/test262/ch11/11.11/shell.js b/js/src/tests/test262/ch11/11.11/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.11/shell.js |