| 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 = '10.1.3-1.js'; |
| 7 | |
| 8 | /** |
| 9 | File Name: 10.1.3-1.js |
| 10 | ECMA Section: 10.1.3 |
| 11 | Description: |
| 12 | |
| 13 | For each formal parameter, as defined in the FormalParameterList, create |
| 14 | a property of the variable object whose name is the Identifier and whose |
| 15 | attributes are determined by the type of code. The values of the |
| 16 | parameters are supplied by the caller. If the caller supplies fewer |
| 17 | parameter values than there are formal parameters, the extra formal |
| 18 | parameters have value undefined. If two or more formal parameters share |
| 19 | the same name, hence the same property, the corresponding property is |
| 20 | given the value that was supplied for the last parameter with this name. |
| 21 | If the value of this last parameter was not supplied by the caller, |
| 22 | the value of the corresponding property is undefined. |
| 23 | |
| 24 | |
| 25 | http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191 |
| 26 | |
| 27 | Author: [email protected] |
| 28 | Date: 12 november 1997 |
| 29 | */ |
| 30 | |
| 31 | var SECTION = "10.1.3-1"; |
| 32 | var VERSION = "ECMA_1"; |
| 33 | var TITLE = "Variable Instantiation: Formal Parameters"; |
| 34 | var BUGNUMBER="104191"; |
| 35 | startTest(); |
| 36 | |
| 37 | writeHeaderToLog( SECTION + " "+ TITLE); |
| 38 | |
| 39 | var myfun1 = new Function( "a", "a", "return a" ); |
| 40 | var myfun2 = new Function( "a", "b", "a", "return a" ); |
| 41 | |
| 42 | function myfun3(a, b, a) { |
| 43 | return a; |
| 44 | } |
| 45 | |
| 46 | // myfun1, myfun2, myfun3 tostring |
| 47 | |
| 48 | |
| 49 | new TestCase( |
| 50 | SECTION, |
| 51 | String(myfun2) +"; myfun2(2,4,8)", |
| 52 | 8, |
| 53 | myfun2(2,4,8) ); |
| 54 | |
| 55 | new TestCase( |
| 56 | SECTION, |
| 57 | "myfun2(2,4)", |
| 58 | void 0, |
| 59 | myfun2(2,4)); |
| 60 | |
| 61 | new TestCase( |
| 62 | SECTION, |
| 63 | String(myfun3) +"; myfun3(2,4,8)", |
| 64 | 8, |
| 65 | myfun3(2,4,8) ); |
| 66 | |
| 67 | new TestCase( |
| 68 | SECTION, |
| 69 | "myfun3(2,4)", |
| 70 | void 0, |
| 71 | myfun3(2,4) ); |
| 72 | |
| 73 | test(); |
| 74 |