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

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

mercurial