js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/ch11/11.4/11.4.3/S11.4.3_A3.6.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +// Copyright 2009 the Sputnik authors.  All rights reserved.
     1.5 +// This code is governed by the BSD license found in the LICENSE file.
     1.6 +
     1.7 +/**
     1.8 + * Result of applying "typeof" operator to the object that is native and doesn't implement [[Call]] is "object"
     1.9 + *
    1.10 + * @path ch11/11.4/11.4.3/S11.4.3_A3.6.js
    1.11 + * @description typeof (object without [[Call]]) === "object"
    1.12 + */
    1.13 +
    1.14 +//CHECK#1
    1.15 +if (typeof this !== "object") {
    1.16 +  $ERROR('#1: typeof this === "object". Actual: ' + (typeof this));
    1.17 +}
    1.18 +
    1.19 +//CHECK#2
    1.20 +if (typeof new Object() !== "object") {
    1.21 +  $ERROR('#2: typeof new Object() === "object". Actual: ' + (typeof new Object()));
    1.22 +}
    1.23 +
    1.24 +//CHECK#3
    1.25 +if (typeof new Array(1,2,3) !== "object") {
    1.26 +  $ERROR('#3: typeof new Array(1,2,3) === "object". Actual: ' + (typeof new Array(1,2,3)));
    1.27 +}
    1.28 +
    1.29 +//CHECK#4
    1.30 +if (typeof Array(1,2,3) !== "object") {
    1.31 +  $ERROR('#4: typeof Array(1,2,3) === "object". Actual: ' + (typeof Array(1,2,3)));
    1.32 +}
    1.33 +
    1.34 +//CHECK#5
    1.35 +if (typeof new String("x") !== "object") {
    1.36 +  $ERROR('#5: typeof new String("x") === "object". Actual: ' + (typeof new String("x")));
    1.37 +}
    1.38 +
    1.39 +//CHECK#6
    1.40 +if (typeof new Boolean(true) !== "object") {
    1.41 +  $ERROR('#6: typeof new Boolean(true) === "object". Actual: ' + (typeof new Boolean(true)));
    1.42 +}
    1.43 +
    1.44 +//CHECK#7
    1.45 +if (typeof new Number(1) !== "object") {
    1.46 +  $ERROR('#7: typeof new Number(1) === "object". Actual: ' + (typeof new Number(1)));
    1.47 +}
    1.48 +
    1.49 +//CHECK#8
    1.50 +//The Math object does not have a [[Construct]] property; 
    1.51 +//it is not possible to use the Math object as a constructor with the new operator.
    1.52 +//The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a object.
    1.53 +if (typeof Math !== "object") {
    1.54 +  $ERROR('#8: typeof Math === "object". Actual: ' + (typeof Math));
    1.55 +}
    1.56 +
    1.57 +//CHECK#9
    1.58 +if (typeof new Date() !== "object") {
    1.59 +  $ERROR('#9: typeof new Date() === "object". Actual: ' + (typeof new Date()));
    1.60 +}
    1.61 +
    1.62 +//CHECK#10
    1.63 +if (typeof new Error() !== "object") {
    1.64 +  $ERROR('#10: typeof new Error() === "object". Actual: ' + (typeof new Error()));
    1.65 +}
    1.66 +
    1.67 +//CHECK#11
    1.68 +if (typeof new RegExp() !== "object") {
    1.69 +  $ERROR('#11: typeof new RegExp() === "object". Actual: ' + (typeof new RegExp()));
    1.70 +}
    1.71 +
    1.72 +//CHECK#12
    1.73 +if (typeof RegExp() !== "object") {
    1.74 +  $ERROR('#12: typeof RegExp() === "object". Actual: ' + (typeof RegExp()));
    1.75 +}
    1.76 +

mercurial