diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.11/11.11.1')
18 files changed, 521 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 |