diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.4/11.4.3')
12 files changed, 370 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A1.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A1.js new file mode 100644 index 000000000..5021bab91 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_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 "typeof" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.3/S11.4.3_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 0; typeof\u0009x") !== "number") { + $ERROR('#1: var x = 0; typeof\\u0009x; x === "number". Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; typeof\u000Bx") !== "number") { + $ERROR('#2: var x = 0; typeof\\u000Bx; x === "number". Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; typeof\u000Cx") !== "number") { + $ERROR('#3: var x = 0; typeof\\u000Cx; x === "number". Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; typeof\u0020x") !== "number") { + $ERROR('#4: var x = 0; typeof\\u0020x; x === "number". Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; typeof\u00A0x") !== "number") { + $ERROR('#5: var x = 0; typeof\\u00A0x; x === "number". Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; typeof\u000Ax") !== "number") { + $ERROR('#6: var x = 0; typeof\\u000Ax; x === "number". Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 0; typeof\u000Dx") !== "number") { + $ERROR('#7: var x = 0; typeof\\u000Dx; x === "number". Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 0; typeof\u2028x") !== "number") { + $ERROR('#8: var x = 0; typeof\\u2028x; x === "number". Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 0; typeof\u2029x") !== "number") { + $ERROR('#9: var x = 0; typeof\\u2029x; x === "number". Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== "number") { + $ERROR('#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number". Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T1.js new file mode 100644 index 000000000..02217c333 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_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. + +/** + * Operator "typeof" uses GetValue + * + * @path ch11/11.4/11.4.3/S11.4.3_A2_T1.js + * @description Either Type(x) is not Reference or GetBase(x) is not null + */ + +//CHECK#1 +if (typeof 0 !== "number") { + $ERROR('#1: typeof 0 === "number". Actual: ' + (typeof 0)); +} + +//CHECK#2 +var x = 0; +if (typeof x !== "number") { + $ERROR('#2: typeof x === "number". Actual: ' + (typeof x)); +} + +//CHECK#3 +var x = new Object(); +if (typeof x !== "object") { + $ERROR('#3: var x = new Object(); typeof x === "object". Actual: ' + (typeof x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T2.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T2.js new file mode 100644 index 000000000..4030c1257 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A2_T2.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 "typeof" uses GetValue + * + * @path ch11/11.4/11.4.3/S11.4.3_A2_T2.js + * @description If GetBase(x) is null, return "undefined" + */ + +//CHECK#1 +if (typeof x !== "undefined") { + $ERROR('#1: typeof x === "undefined". Actual: ' + (typeof x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.1.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.1.js new file mode 100644 index 000000000..1609ad326 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.1.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. + +/** + * Result of applying "typeof" operator to undefined is "undefined" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.1.js + * @description typeof undefined === "undefined" + */ + +//CHECK#1 +if (typeof undefined !== "undefined") { + $ERROR('#1: typeof undefined === "undefined". Actual: ' + (typeof undefined)); +} + +//CHECK#2 +if (typeof void 0 !== "undefined") { + $ERROR('#2: typeof void 0 === "undefined". Actual: ' + (typeof void 0)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.2.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.2.js new file mode 100644 index 000000000..94353f557 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.2.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. + +/** + * Result of applying "typeof" operator to null is "object" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.2.js + * @description typeof null === "object" + */ + +//CHECK#1 +if (typeof null !== "object") { + $ERROR('#1: typeof null === "object". Actual: ' + (typeof null)); +} + +//CHECK#2 +if (typeof RegExp("0").exec("1") !== "object") { + $ERROR('#2: typeof RegExp("0").exec("1") === "object". Actual: ' + (typeof RegExp("0").exec("1"))); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.3.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.3.js new file mode 100644 index 000000000..70dcf3ec6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of applying "typeof" operator to boolean is "boolean" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.3.js + * @description typeof (boolean value) === "boolean" + */ + +//CHECK#1 +if (typeof true !== "boolean") { + $ERROR('#1: typeof true === "boolean". Actual: ' + (typeof true)); +} + +//CHECK#2 +if (typeof false !== "boolean") { + $ERROR('#2: typeof false === "boolean". Actual: ' + (typeof false)); +} + +//CHECK#3 +if (typeof !-1 !== "boolean") { + $ERROR('#3: typeof !-1 === "boolean". Actual: ' + (typeof !-1)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.4.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.4.js new file mode 100644 index 000000000..e1444e9f5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.4.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of appying "typeof" operator to number is "number" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.4.js + * @description typeof (number value) === "number" + */ + +//CHECK#1 +if (typeof 1 !== "number") { + $ERROR('#1: typeof 1 === "number". Actual: ' + (typeof 1)); +} + +//CHECK#2 +if (typeof Number.NaN !== "number") { + $ERROR('#2: typeof NaN === "number". Actual: ' + (typeof NaN)); +} + +//CHECK#3 +if (typeof Number.POSITIVE_INFINITY !== "number") { + $ERROR('#3: typeof Infinity === "number". Actual: ' + (typeof Infinity)); +} + +//CHECK#4 +if (typeof Number.NEGATIVE_INFINITY !== "number") { + $ERROR('#4: typeof -Infinity === "number". Actual: ' + (typeof -Infinity)); +} + +//CHECK#5 +if (typeof Math.PI !== "number") { + $ERROR('#5: typeof Math.PI === "number". Actual: ' + (typeof Math.PI)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.5.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.5.js new file mode 100644 index 000000000..f1c07acd1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.5.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. + +/** + * Result of appying "typeof" operator to string is "string" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.5.js + * @description typeof (string value) === "string" + */ + +//CHECK#1 +if (typeof "1" !== "string") { + $ERROR('#1: typeof "1" === "string". Actual: ' + (typeof "1")); +} + +//CHECK#2 +if (typeof "NaN" !== "string") { + $ERROR('#2: typeof "NaN" === "string". Actual: ' + (typeof "NaN")); +} + +//CHECK#3 +if (typeof "Infinity" !== "string") { + $ERROR('#3: typeof "Infinity" === "string". Actual: ' + (typeof "Infinity")); +} + +//CHECK#4 +if (typeof "" !== "string") { + $ERROR('#4: typeof "" === "string". Actual: ' + (typeof "")); +} + +//CHECK#5 +if (typeof "true" !== "string") { + $ERROR('#5: typeof "true" === "string". Actual: ' + (typeof "true")); +} + +//CHECK#6 +if (typeof Date() !== "string") { + $ERROR('#6: typeof Date() === "string". Actual: ' + (typeof Date())); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js new file mode 100644 index 000000000..feab82ac6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js @@ -0,0 +1,73 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of applying "typeof" operator to the object that is native and doesn't implement [[Call]] is "object" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.6.js + * @description typeof (object without [[Call]]) === "object" + */ + +//CHECK#1 +if (typeof this !== "object") { + $ERROR('#1: typeof this === "object". Actual: ' + (typeof this)); +} + +//CHECK#2 +if (typeof new Object() !== "object") { + $ERROR('#2: typeof new Object() === "object". Actual: ' + (typeof new Object())); +} + +//CHECK#3 +if (typeof new Array(1,2,3) !== "object") { + $ERROR('#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3))); +} + +//CHECK#4 +if (typeof Array(1,2,3) !== "object") { + $ERROR('#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3))); +} + +//CHECK#5 +if (typeof new String("x") !== "object") { + $ERROR('#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x"))); +} + +//CHECK#6 +if (typeof new Boolean(true) !== "object") { + $ERROR('#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true))); +} + +//CHECK#7 +if (typeof new Number(1) !== "object") { + $ERROR('#7: typeof new Number(1) === "object". Actual: ' + (typeof new Number(1))); +} + +//CHECK#8 +//The Math object does not have a [[Construct]] property; +//it is not possible to use the Math object as a constructor with the new operator. +//The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a object. +if (typeof Math !== "object") { + $ERROR('#8: typeof Math === "object". Actual: ' + (typeof Math)); +} + +//CHECK#9 +if (typeof new Date() !== "object") { + $ERROR('#9: typeof new Date() === "object". Actual: ' + (typeof new Date())); +} + +//CHECK#10 +if (typeof new Error() !== "object") { + $ERROR('#10: typeof new Error() === "object". Actual: ' + (typeof new Error())); +} + +//CHECK#11 +if (typeof new RegExp() !== "object") { + $ERROR('#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp())); +} + +//CHECK#12 +if (typeof RegExp() !== "object") { + $ERROR('#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp())); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.7.js b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.7.js new file mode 100644 index 000000000..66282799a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.7.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Result of applying "typeof" operator to the object that is native and implements [[Call]] is "function" + * + * @path ch11/11.4/11.4.3/S11.4.3_A3.7.js + * @description typeof (object with [[Call]]) === "function" + */ + +//CHECK#1 +if (typeof new Function() !== "function") { + $ERROR('#1: typeof new Function() === "function". Actual: ' + (typeof new Function())); +} + +//CHECK#2 +if (typeof Function() !== "function") { + $ERROR('#2: typeof Function() === "function". Actual: ' + (typeof Function())); +} + +//CHECK#3 +if (typeof Object !== "function") { + $ERROR('#3: typeof Object === "function". Actual: ' + (typeof Object)); +} + +//CHECK#4 +if (typeof String !== "function") { + $ERROR('#4: typeof String === "function". Actual: ' + (typeof String)); +} + +//CHECK5 +if (typeof Boolean !== "function") { + $ERROR('#5: typeof Boolean === "function". Actual: ' + (typeof Boolean)); +} + +//CHECK#6 +if (typeof Number !== "function") { + $ERROR('#6: typeof Number === "function". Actual: ' + (typeof Number)); +} + +//CHECK#7 +if (typeof Date !== "function") { + $ERROR('#7: typeof Date === "function". Actual: ' + (typeof Date)); +} + +//CHECK#8 +if (typeof Error !== "function") { + $ERROR('#8: typeof Error === "function". Actual: ' + (typeof Error)); +} + +//CHECK#9 +if (typeof RegExp !== "function") { + $ERROR('#9: typeof RegExp === "function". Actual: ' + (typeof RegExp)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/browser.js b/js/src/tests/test262/ch11/11.4/11.4.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.3/shell.js b/js/src/tests/test262/ch11/11.4/11.4.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.3/shell.js |