Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/new/S11.2.2_A4_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 NewExpression or MemberExpression does not implement internal
7 [[Construct]] method, throw TypeError
8 es5id: 11.2.2_A4_T5
9 description: Checking Math object case
10 ---*/
11
12 //CHECK#1
13 try {
14 new Math;
15 $ERROR('#1: new Math throw TypeError');
16 }
17 catch (e) {
18 if ((e instanceof TypeError) !== true) {
19 $ERROR('#1: new Math throw TypeError');
20 }
21 }
22
23 //CHECK#2
24 try {
25 new new Math();
26 $ERROR('#2: new new Math() throw TypeError');
27 }
28 catch (e) {
29 if ((e instanceof TypeError) !== true) {
30 $ERROR('#2: new new Math() throw TypeError');
31 }
32 }
33
34 //CHECK#3
35 try {
36 var x = new Math();
37 new x();
38 $ERROR('#3: var x = new Math(); new x() throw TypeError');
39 }
40 catch (e) {
41 if ((e instanceof TypeError) !== true) {
42 $ERROR('#3: var x = new Math(); new x() throw TypeError');
43 }
44 }