Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/new/S11.2.2_A3_T5.js

raw
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: |
6 If Type(NewExpression) or Type(MemberExpression) is not Object, throw
7 TypeError
8 es5id: 11.2.2_A3_T5
9 description: Checking "null primitive" case
10 ---*/
11
12 //CHECK#1
13 try {
14 new null;
15 $ERROR('#1: new null throw TypeError');
16 }
17 catch (e) {
18 if ((e instanceof TypeError) !== true) {
19 $ERROR('#1: new null throw TypeError');
20 }
21 }
22
23 //CHECK#2
24 try {
25 var x = null;
26 new x;
27 $ERROR('#2: var x = null; new x throw TypeError');
28 }
29 catch (e) {
30 if ((e instanceof TypeError) !== true) {
31 $ERROR('#2: var x = null; new x throw TypeError');
32 }
33 }
34
35 //CHECK#3
36 try {
37 var x = null;
38 new x();
39 $ERROR('#3: var x = null; new x() throw TypeError');
40 }
41 catch (e) {
42 if ((e instanceof TypeError) !== true) {
43 $ERROR('#3: var x = null; new x() throw TypeError');
44 }
45 }