|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * If ShiftExpression is not an object, throw TypeError |
|
6 * |
|
7 * @path ch11/11.8/11.8.7/S11.8.7_A3.js |
|
8 * @description Checking all the types of primitives |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 try { |
|
13 "toString" in true; |
|
14 $ERROR('#1: "toString" in true throw TypeError'); |
|
15 } |
|
16 catch (e) { |
|
17 if ((e instanceof TypeError) !== true) { |
|
18 $ERROR('#1: "toString" in true throw TypeError'); |
|
19 } |
|
20 } |
|
21 |
|
22 //CHECK#2 |
|
23 try { |
|
24 "MAX_VALUE" in 1; |
|
25 $ERROR('#2: "MAX_VALUE" in 1 throw TypeError'); |
|
26 } |
|
27 catch (e) { |
|
28 if ((e instanceof TypeError) !== true) { |
|
29 $ERROR('#2: "MAX_VALUE" in 1 throw TypeError'); |
|
30 } |
|
31 } |
|
32 |
|
33 //CHECK#3 |
|
34 try { |
|
35 "length" in "string"; |
|
36 $ERROR('#3: "length" in "string" throw TypeError'); |
|
37 } |
|
38 catch (e) { |
|
39 if ((e instanceof TypeError) !== true) { |
|
40 $ERROR('#3: "length" in "string" throw TypeError'); |
|
41 } |
|
42 } |
|
43 |
|
44 //CHECK#4 |
|
45 try { |
|
46 "toString" in undefined; |
|
47 $ERROR('#4: "toString" in undefined throw TypeError'); |
|
48 } |
|
49 catch (e) { |
|
50 if ((e instanceof TypeError) !== true) { |
|
51 $ERROR('#4: "toString" in undefined throw TypeError'); |
|
52 } |
|
53 } |
|
54 |
|
55 //CHECK#5 |
|
56 try { |
|
57 "toString" in null; |
|
58 $ERROR('#5: "toString" in null throw TypeError'); |
|
59 } |
|
60 catch (e) { |
|
61 if ((e instanceof TypeError) !== true) { |
|
62 $ERROR('#5: "toString" in null throw TypeError'); |
|
63 } |
|
64 } |
|
65 |