| 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 |
flags: [noStrict] |
| 11 |
---*/ |
| 12 |
|
| 13 |
//CHECK#1 |
| 14 |
function SetThis() {this.THIS = this} |
| 15 |
if ((new SetThis()).THIS.toString() !== "[object Object]") { |
| 16 |
$ERROR('#1: function SetThis() {this.THIS = this} (new SetThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetThis()).THIS.toString())); |
| 17 |
} |
| 18 |
|
| 19 |
//CHECK#2 |
| 20 |
function SetEvalThis() {this.THIS = eval("this")} |
| 21 |
if ((new SetEvalThis()).THIS.toString() !== "[object Object]") { |
| 22 |
$ERROR('#2: function SetEvalThis() {this.THIS = eval("this")} (new SetEvalThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetEvalThis()).THIS.toString())); |
| 23 |
} |