| 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-2.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: 15.3.1.1-2.js |
| 10 | ECMA Section: 15.3.1.1 The Function Constructor Called as a Function |
| 11 | Function(p1, p2, ..., pn, body ) |
| 12 | |
| 13 | Description: |
| 14 | When the Function function is called with some arguments p1, p2, . . . , pn, |
| 15 | body (where n might be 0, that is, there are no "p" arguments, and where body |
| 16 | might also not be provided), the following steps are taken: |
| 17 | |
| 18 | 1. Create and return a new Function object exactly if the function constructor |
| 19 | had been called with the same arguments (15.3.2.1). |
| 20 | |
| 21 | Author: [email protected] |
| 22 | Date: 28 october 1997 |
| 23 | |
| 24 | */ |
| 25 | var SECTION = "15.3.1.1-2"; |
| 26 | var VERSION = "ECMA_1"; |
| 27 | startTest(); |
| 28 | var TITLE = "The Function Constructor Called as a Function"; |
| 29 | |
| 30 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 31 | |
| 32 | var myfunc2 = Function("a, b, c", "return a+b+c" ); |
| 33 | var myfunc3 = Function("a,b", "c", "return a+b+c" ); |
| 34 | |
| 35 | myfunc2.toString = Object.prototype.toString; |
| 36 | myfunc3.toString = Object.prototype.toString; |
| 37 | |
| 38 | |
| 39 | new TestCase( SECTION, |
| 40 | "myfunc2.__proto__", |
| 41 | Function.prototype, |
| 42 | myfunc2.__proto__ ); |
| 43 | |
| 44 | new TestCase( SECTION, |
| 45 | "myfunc3.__proto__", |
| 46 | Function.prototype, |
| 47 | myfunc3.__proto__ ); |
| 48 | |
| 49 | test(); |