summaryrefslogtreecommitdiff
path: root/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.3_The_typeof_Operator/S11.4.3_A3.6.js
blob: af1b8552d4c9c12de037baf282730000d7613910 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S11.4.3_A3.6;
* @section: 11.4.3;
* @assertion: Result of applying "typeof" operator to the object that is native and doesn't implement [[Call]] is "object";
* @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()));
}