Debian Codegraph @

js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.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 Being in function code, "this" and eval("this"), called as a
7 constructors, return the object
8 es5id: 11.1.1_A3.2
9 description: Create function. It have property, that returned "this"
10 ---*/
11
12 //CHECK#1
13 function SetThis() {this.THIS = this}
14 if ((new SetThis()).THIS.toString() !== "[object Object]") {
15 throw new Test262Error('#1: function SetThis() {this.THIS = this} (new SetThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetThis()).THIS.toString()));
16 }
17
18 //CHECK#2
19 function SetEvalThis() {this.THIS = eval("this")}
20 if ((new SetEvalThis()).THIS.toString() !== "[object Object]") {
21 throw new Test262Error('#2: function SetEvalThis() {this.THIS = eval("this")} (new SetEvalThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetEvalThis()).THIS.toString()));
22 }
23
24 reportCompare(0, 0);