js/src/tests/test262/ch09/9.9/S9.9_A2.js

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:0168d2610242
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 * ToObject conversion from null value must throw TypeError
6 *
7 * @path ch09/9.9/S9.9_A2.js
8 * @description Trying to convert null to Object
9 * @noStrict
10 */
11
12 // CHECK#1
13 try{
14 null['foo'];
15 $ERROR('#1.1: null[\'foo\'] throw TypeError. Actual: ' + (null['foo']));
16 }
17 catch(e){
18 if((e instanceof TypeError) !== true){
19 $ERROR('#1.2: null[\'foo\'] must throw TypeError. Actual: ' + (e));
20 }
21 }
22
23 // CHECK#2
24 try{
25 with(null) x = 2;
26 $ERROR('#2.1: with(null) x = 2 must throw TypeError. Actual: x === . Actual: ' + (x));
27 }
28 catch(e){
29 if((e instanceof TypeError) !== true){
30 $ERROR('#2.2: with(null) x = 2 must throw TypeError. Actual: ' + (e));
31 }
32 }
33

mercurial