| 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 |
When Function object(F) is constructed the following steps from 9 to 11 take place |
| 7 |
9.Create a new object as would be constructed by the expression new Object(). |
| 8 |
10. Set the constructor property of Result(9) to F. This property is given attributes { DontEnum }. |
| 9 |
11. Set the "prototype" property of F to Result(9). |
| 10 |
es5id: 13.2_A4_T1 |
| 11 |
description: > |
| 12 |
Checking prototype, prototype.constructor properties and |
| 13 |
{DontEnum} property of a constructor. Using "function __func(){}" |
| 14 |
as a FunctionDeclaration |
| 15 |
---*/ |
| 16 |
|
| 17 |
function __func(){}; |
| 18 |
|
| 19 |
////////////////////////////////////////////////////////////////////////////// |
| 20 |
//CHECK#1 |
| 21 |
if (typeof __func.prototype !== 'object') { |
| 22 |
throw new Test262Error('#1: typeof __func.prototype === \'object\'. Actual: typeof __gunc.prototype ==='+typeof __gunc.prototype); |
| 23 |
} |
| 24 |
// |
| 25 |
////////////////////////////////////////////////////////////////////////////// |
| 26 |
|
| 27 |
////////////////////////////////////////////////////////////////////////////// |
| 28 |
//CHECK#2 |
| 29 |
if (__func.prototype.constructor !== __func) { |
| 30 |
throw new Test262Error('#2: __func.prototype.constructor === __func. Actual: __gunc.prototype.constructor ==='+__gunc.prototype.constructor); |
| 31 |
} |
| 32 |
// |
| 33 |
////////////////////////////////////////////////////////////////////////////// |
| 34 |
|
| 35 |
var __constructor_was__enumed; |
| 36 |
|
| 37 |
for (__prop in __func.prototype){ |
| 38 |
if (__prop === 'constructor') |
| 39 |
__constructor_was__enumed = true; |
| 40 |
} |
| 41 |
|
| 42 |
////////////////////////////////////////////////////////////////////////////// |
| 43 |
//CHECK#3 |
| 44 |
if (__constructor_was__enumed) { |
| 45 |
throw new Test262Error('#3: __constructor_was__enumed === false. Actual: __constructor_was__enumed ==='+__constructor_was__enumed); |
| 46 |
} |
| 47 |
// |
| 48 |
////////////////////////////////////////////////////////////////////////////// |
| 49 |
|
| 50 |
reportCompare(0, 0); |