]>
Commit | Line | Data |
---|---|---|
b37bf2e1 A |
1 | /* The contents of this file are subject to the Netscape Public |
2 | * License Version 1.1 (the "License"); you may not use this file | |
3 | * except in compliance with the License. You may obtain a copy of | |
4 | * the License at http://www.mozilla.org/NPL/ | |
5 | * | |
6 | * Software distributed under the License is distributed on an "AS | |
7 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | |
8 | * implied. See the License for the specific language governing | |
9 | * rights and limitations under the License. | |
10 | * | |
11 | * The Original Code is Mozilla Communicator client code, released March | |
12 | * 31, 1998. | |
13 | * | |
14 | * The Initial Developer of the Original Code is Netscape Communications | |
15 | * Corporation. Portions created by Netscape are | |
16 | * Copyright (C) 1998 Netscape Communications Corporation. All | |
17 | * Rights Reserved. | |
18 | * | |
19 | * Contributor(s): | |
20 | * | |
21 | */ | |
22 | /** | |
23 | File Name: 10.1.3-1.js | |
24 | ECMA Section: 10.1.3 | |
25 | Description: | |
26 | ||
27 | For each formal parameter, as defined in the FormalParameterList, create | |
28 | a property of the variable object whose name is the Identifier and whose | |
29 | attributes are determined by the type of code. The values of the | |
30 | parameters are supplied by the caller. If the caller supplies fewer | |
31 | parameter values than there are formal parameters, the extra formal | |
32 | parameters have value undefined. If two or more formal parameters share | |
33 | the same name, hence the same property, the corresponding property is | |
34 | given the value that was supplied for the last parameter with this name. | |
35 | If the value of this last parameter was not supplied by the caller, | |
36 | the value of the corresponding property is undefined. | |
37 | ||
38 | ||
39 | http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191 | |
40 | ||
41 | Author: christine@netscape.com | |
42 | Date: 12 november 1997 | |
43 | */ | |
44 | ||
45 | var SECTION = "10.1.3-1"; | |
46 | var VERSION = "ECMA_1"; | |
47 | startTest(); | |
48 | var TITLE = "Variable Instantiation: Formal Parameters"; | |
49 | var BUGNUMBER="104191"; | |
50 | ||
51 | writeHeaderToLog( SECTION + " "+ TITLE); | |
52 | ||
53 | var testcases = new Array(); | |
54 | ||
55 | var myfun1 = new Function( "a", "a", "return a" ); | |
56 | var myfun2 = new Function( "a", "b", "a", "return a" ); | |
57 | ||
58 | function myfun3(a, b, a) { | |
59 | return a; | |
60 | } | |
61 | ||
62 | // myfun1, myfun2, myfun3 tostring | |
63 | ||
64 | ||
65 | testcases[tc++] = new TestCase( | |
66 | SECTION, | |
67 | String(myfun2) +"; myfun2(2,4,8)", | |
68 | 8, | |
69 | myfun2(2,4,8) ); | |
70 | ||
71 | testcases[tc++] = new TestCase( | |
72 | SECTION, | |
73 | "myfun2(2,4)", | |
74 | void 0, | |
75 | myfun2(2,4)); | |
76 | ||
77 | testcases[tc++] = new TestCase( | |
78 | SECTION, | |
79 | String(myfun3) +"; myfun3(2,4,8)", | |
80 | 8, | |
81 | myfun3(2,4,8) ); | |
82 | ||
83 | testcases[tc++] = new TestCase( | |
84 | SECTION, | |
85 | "myfun3(2,4)", | |
86 | void 0, | |
87 | myfun3(2,4) ); | |
88 | ||
89 | ||
90 | ||
91 | ||
92 | ||
93 | test(); | |
94 | ||
95 | function test() { | |
96 | for ( tc=0; tc < testcases.length; tc++ ) { | |
97 | testcases[tc].passed = writeTestCaseResult( | |
98 | testcases[tc].expect, | |
99 | testcases[tc].actual, | |
100 | testcases[tc].description +" = "+ | |
101 | testcases[tc].actual ); | |
102 | ||
103 | testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; | |
104 | } | |
105 | stopTest(); | |
106 | return ( testcases ); | |
107 | } |