diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.12')
17 files changed, 388 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A1.js b/js/src/tests/test262/ch11/11.12/S11.12_A1.js new file mode 100644 index 000000000..b813aeb7f --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A1.js @@ -0,0 +1,60 @@ +// 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 AssignmentExpression or between AssignmentExpression and ":" or between ":" and AssignmentExpression are allowed + * + * @path ch11/11.12/S11.12_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if ((eval("false\u0009?\u0009true\u0009:\u0009true")) !== true) { + $ERROR('#1: (false\\u0009?\\u0009true\\u0009:\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("false\u000B?\u000Btrue\u000B:\u000Btrue")) !== true) { + $ERROR('#2: (false\\u000B?\\u000Btrue\\u000B:\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("false\u000C?\u000Ctrue\u000C:\u000Ctrue")) !== true) { + $ERROR('#3: (false\\u000C?\\u000Ctrue\\u000C:\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("false\u0020?\u0020true\u0020:\u0020true")) !== true) { + $ERROR('#4: (false\\u0020?\\u0020true\\u0020:\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("false\u00A0?\u00A0true\u00A0:\u00A0true")) !== true) { + $ERROR('#5: (false\\u00A0?\\u00A0true\\u00A0:\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("false\u000A?\u000Atrue\u000A:\u000Atrue")) !== true) { + $ERROR('#6: (false\\u000A?\\u000Atrue\\u000A:\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("false\u000D?\u000Dtrue\u000D:\u000Dtrue")) !== true) { + $ERROR('#7: (false\\u000D?\\u000Dtrue\\u000D:\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("false\u2028?\u2028true\u2028:\u2028true")) !== true) { + $ERROR('#8: (false\\u2028?\\u2028true\\u2028:\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("false\u2029?\u2029true\u2029:\u2029true")) !== true) { + $ERROR('#9: (false\\u2029?\\u2029true\\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\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\\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.12/S11.12_A2.1_T1.js b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T1.js new file mode 100644 index 000000000..2a9e568a9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T1.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x ? y : z uses GetValue + * + * @path ch11/11.12/S11.12_A2.1_T1.js + * @description Either Type is not Reference or GetBase is not null + */ + +//CHECK#1 +if ((true ? false : true) !== false) { + $ERROR('#1: (true ? false : true) === false'); +} + +//CHECK#2 +if ((false ? false : true) !== true) { + $ERROR('#2: (false ? false : true) === true'); +} + +//CHECK#3 +var x = new Boolean(true); +var y = new Boolean(false); +if ((x ? y : true) !== y) { + $ERROR('#3: var x = new Boolean(true); var y = new Boolean(false); (x ? y : true) === y'); +} + +//CHECK#4 +var z = new Boolean(true); +if ((false ? false : z) !== z) { + $ERROR('#4: var z = new Boolean(true); (false ? false : z) === z'); +} + +//CHECK#5 +var x = new Boolean(true); +var y = new Boolean(false); +var z = new Boolean(true); +if ((x ? y : z) !== y) { + $ERROR('#5: var x = new Boolean(true); var y = new Boolean(false); var z = new Boolean(true); (x ? y : z) === y'); +} + +//CHECK#6 +var x = false; +var y = new Boolean(false); +var z = new Boolean(true); +if ((x ? y : z) !== z) { + $ERROR('#6: var x = false; var y = new Boolean(false); var z = new Boolean(true); (x ? y : z) === z'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T2.js b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T2.js new file mode 100644 index 000000000..465976c49 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_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 : z uses GetValue + * + * @path ch11/11.12/S11.12_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x ? true : false; + $ERROR('#1.1: x ? true : false throw ReferenceError. Actual: ' + (x ? true : false)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x ? true : false throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T3.js b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T3.js new file mode 100644 index 000000000..1e59cd63a --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_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 : z uses GetValue + * + * @path ch11/11.12/S11.12_A2.1_T3.js + * @description If ToBoolean(x) is true and GetBase(y) is null, throw ReferenceError + */ + +//CHECK#1 +try { + true ? y : false; + $ERROR('#1.1: true ? y : false throw ReferenceError. Actual: ' + (true ? y : false)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: true ? y : false throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T4.js b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T4.js new file mode 100644 index 000000000..0d3c01b29 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T4.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 : z uses GetValue + * + * @path ch11/11.12/S11.12_A2.1_T4.js + * @description If ToBoolean(x) is false and GetBase(z) is null, throw ReferenceError + */ + +//CHECK#1 +try { + false ? true : z; + $ERROR('#1.1: false ? true : z throw ReferenceError. Actual: ' + (false ? true : z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: false ? true : z throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T5.js b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T5.js new file mode 100644 index 000000000..05df26fa5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T5.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x ? y : z uses GetValue + * + * @path ch11/11.12/S11.12_A2.1_T5.js + * @description If ToBoolean(x) is true and GetBase(z) is null, return y + */ + +//CHECK#1 +var y = new Object(); +if ((true ? y : z) !== y) { + $ERROR('#1: var y = new Object(); (true ? y : z) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T6.js b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T6.js new file mode 100644 index 000000000..f25c22a52 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A2.1_T6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x ? y : z uses GetValue + * + * @path ch11/11.12/S11.12_A2.1_T6.js + * @description If ToBoolean(x) is false and GetBase(y) is null, return z + */ + +//CHECK#1 +var z = new Object(); +if ((false ? y : z) !== z) { + $ERROR('#1: var z = new Object(); (false ? y : z) === z'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A3_T1.js b/js/src/tests/test262/ch11/11.12/S11.12_A3_T1.js new file mode 100644 index 000000000..6614bb7f2 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A3_T1.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 z + * + * @path ch11/11.12/S11.12_A3_T1.js + * @description Type(y) and Type(z) are boolean primitives + */ + +//CHECK#1 +if ((false ? false : true) !== true) { + $ERROR('#1: (false ? false : true) === true'); +} + +//CHECK#2 +var z = new Boolean(true); +if ((false ? true : z) !== z) { + $ERROR('#2: (var y = new Boolean(true); (false ? true : z) === z'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A3_T2.js b/js/src/tests/test262/ch11/11.12/S11.12_A3_T2.js new file mode 100644 index 000000000..311cce7d1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A3_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. + +/** + * If ToBoolean(x) is false, return z + * + * @path ch11/11.12/S11.12_A3_T2.js + * @description Type(y) and Type(z) are number primitives + */ + +//CHECK#1 +if ((0 ? 0 : 1) !== 1) { + $ERROR('#1: (0 ? 0 : 1) === 1'); +} + +//CHECK#2 +var z = new Number(1); +if ((0 ? 1 : z) !== z) { + $ERROR('#2: (var y = new Number(1); (0 ? 1 : z) === z'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A3_T3.js b/js/src/tests/test262/ch11/11.12/S11.12_A3_T3.js new file mode 100644 index 000000000..644a58fd0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_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 z + * + * @path ch11/11.12/S11.12_A3_T3.js + * @description Type(y) and Type(z) are string primitives + */ + +//CHECK#1 +if (("" ? "" : "1") !== "1") { + $ERROR('#1: ("" ? "" : "1") === "1"'); +} + +//CHECK#2 +var z = new String("1"); +if (("" ? "1" : z) !== z) { + $ERROR('#2: (var y = new String("1"); ("" ? "1" : z) === z'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A3_T4.js b/js/src/tests/test262/ch11/11.12/S11.12_A3_T4.js new file mode 100644 index 000000000..296ae94eb --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_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 z + * + * @path ch11/11.12/S11.12_A3_T4.js + * @description Type(x) or Type(y) is changed between null and undefined + */ + +//CHECK#1 +if ((false ? true : undefined) !== undefined) { + $ERROR('#1: (false ? true : undefined) === undefined'); +} + +//CHECK#2 +if ((false ? true : null) !== null) { + $ERROR('#2: (false ? true : null) === null'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A4_T1.js b/js/src/tests/test262/ch11/11.12/S11.12_A4_T1.js new file mode 100644 index 000000000..588d90141 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A4_T1.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. + +/** + * If ToBoolean(x) is true, return y + * + * @path ch11/11.12/S11.12_A4_T1.js + * @description Type(y) and Type(z) are boolean primitives + */ + +//CHECK#1 +if ((true ? false : true) !== false) { + $ERROR('#1: (true ? false : true) === false'); +} + +//CHECK#2 +var y = new Boolean(true); +if ((true ? y : false) !== y) { + $ERROR('#2: (var y = new Boolean(true); (true ? y : false) === y'); +} + +//CHECK#3 +var y = new Boolean(false); +if ((y ? y : true) !== y) { + $ERROR('#3: (var y = new Boolean(false); (y ? y : true) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A4_T2.js b/js/src/tests/test262/ch11/11.12/S11.12_A4_T2.js new file mode 100644 index 000000000..eda208159 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A4_T2.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. + +/** + * If ToBoolean(x) is true, return y + * + * @path ch11/11.12/S11.12_A4_T2.js + * @description Type(y) and Type(z) are number primitives + */ + +//CHECK#1 +if ((1 ? 0 : 1) !== 0) { + $ERROR('#1: (1 ? 0 : 1) === 0'); +} + +//CHECK#2 +var y = new Number(1); +if ((1 ? y : 0) !== y) { + $ERROR('#2: (var y = new Number(1); (1 ? y : 0) === y'); +} + +//CHECK#3 +var y = new Number(NaN); +if ((y ? y : 1) !== y) { + $ERROR('#3: (var y = new Number(NaN); (y ? y : 1) === y'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A4_T3.js b/js/src/tests/test262/ch11/11.12/S11.12_A4_T3.js new file mode 100644 index 000000000..168902e13 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_A4_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. + +/** + * If ToBoolean(x) is true, return y + * + * @path ch11/11.12/S11.12_A4_T3.js + * @description Type(y) and Type(z) are string primitives + */ + +//CHECK#1 +if (("1" ? "" : "1") !== "") { + $ERROR('#1: ("1" ? "" : "1") === ""'); +} + +//CHECK#2 +var y = new String("1"); +if (("1" ? y : "") !== y) { + $ERROR('#2: (var y = new String("1"); ("1" ? y : "") === y'); +} + +//CHECK#3 +var y = new String("y"); +if ((y ? y : "1") !== y) { + $ERROR('#3: (var y = new String("y"); (y ? y : "1") === y'); +} + diff --git a/js/src/tests/test262/ch11/11.12/S11.12_A4_T4.js b/js/src/tests/test262/ch11/11.12/S11.12_A4_T4.js new file mode 100644 index 000000000..c3b5f4771 --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/S11.12_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.12/S11.12_A4_T4.js + * @description Type(x) or Type(y) is changed between null and undefined + */ + +//CHECK#1 +if ((true ? undefined : true) !== undefined) { + $ERROR('#1: (true ? undefined : true) === undefined'); +} + +//CHECK#2 +if ((true ? null : true) !== null) { + $ERROR('#2: (true ? null : true) === null'); +} + diff --git a/js/src/tests/test262/ch11/11.12/browser.js b/js/src/tests/test262/ch11/11.12/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/browser.js diff --git a/js/src/tests/test262/ch11/11.12/shell.js b/js/src/tests/test262/ch11/11.12/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.12/shell.js |