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