| 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | gTestfile = '15.3.1.1-1.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: 15.3.1.1.js |
| 10 | ECMA Section: 15.3.1.1 The Function Constructor Called as a Function |
| 11 | |
| 12 | Description: |
| 13 | When the Function function is called with some arguments p1, p2, . . . , pn, body |
| 14 | (where n might be 0, that is, there are no "p" arguments, and where body might |
| 15 | also not be provided), the following steps are taken: |
| 16 | |
| 17 | 1. Create and return a new Function object exactly if the function constructor had |
| 18 | been called with the same arguments (15.3.2.1). |
| 19 | |
| 20 | Author: [email protected] |
| 21 | Date: 28 october 1997 |
| 22 | |
| 23 | */ |
| 24 | var SECTION = "15.3.1.1-1"; |
| 25 | var VERSION = "ECMA_1"; |
| 26 | startTest(); |
| 27 | var TITLE = "The Function Constructor Called as a Function"; |
| 28 | |
| 29 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 30 | |
| 31 | var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" ); |
| 32 | |
| 33 | |
| 34 | var myfunc = Function(); |
| 35 | myfunc.toString = Object.prototype.toString; |
| 36 | |
| 37 | // not going to test toString here since it is implementation dependent. |
| 38 | // new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); |
| 39 | |
| 40 | myfunc.toString = Object.prototype.toString; |
| 41 | |
| 42 | new TestCase( SECTION, |
| 43 | "MyObject.__proto__ == Function.prototype", |
| 44 | true, |
| 45 | MyObject.__proto__ == Function.prototype ); |
| 46 | |
| 47 | test(); |
| 48 | |
| 49 |