|
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.6/S11.8.6_A3.js |
|
8 * @description Checking all the types of primitives |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 try { |
|
13 true instanceof true; |
|
14 $ERROR('#1: true instanceof true throw TypeError'); |
|
15 } |
|
16 catch (e) { |
|
17 if (e instanceof TypeError !== true) { |
|
18 $ERROR('#1: true instanceof true throw TypeError'); |
|
19 } |
|
20 } |
|
21 |
|
22 //CHECK#2 |
|
23 try { |
|
24 1 instanceof 1; |
|
25 $ERROR('#2: 1 instanceof 1 throw TypeError'); |
|
26 } |
|
27 catch (e) { |
|
28 if (e instanceof TypeError !== true) { |
|
29 $ERROR('#2: 1 instanceof 1 throw TypeError'); |
|
30 } |
|
31 } |
|
32 |
|
33 //CHECK#3 |
|
34 try { |
|
35 "string" instanceof "string"; |
|
36 $ERROR('#3: "string" instanceof "string" throw TypeError'); |
|
37 } |
|
38 catch (e) { |
|
39 if (e instanceof TypeError !== true) { |
|
40 $ERROR('#3: "string" instanceof "string" throw TypeError'); |
|
41 } |
|
42 } |
|
43 |
|
44 //CHECK#4 |
|
45 try { |
|
46 undefined instanceof undefined; |
|
47 $ERROR('#4: undefined instanceof undefined throw TypeError'); |
|
48 } |
|
49 catch (e) { |
|
50 if (e instanceof TypeError !== true) { |
|
51 $ERROR('#4: undefined instanceof undefined throw TypeError'); |
|
52 } |
|
53 } |
|
54 |
|
55 //CHECK#5 |
|
56 try { |
|
57 null instanceof null; |
|
58 $ERROR('#5: null instanceof null throw TypeError'); |
|
59 } |
|
60 catch (e) { |
|
61 if (e instanceof TypeError !== true) { |
|
62 $ERROR('#5: null instanceof null throw TypeError'); |
|
63 } |
|
64 } |
|
65 |