initial import
[vuplus_webkit] / Source / JavaScriptCore / tests / mozilla / ecma / FunctionObjects / 15.3.5.1.js
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:          15.3.5.1.js
24     ECMA Section:       Function.length
25     Description:
26
27     The value of the length property is usually an integer that indicates the
28     "typical" number of arguments expected by the function.  However, the
29     language permits the function to be invoked with some other number of
30     arguments. The behavior of a function when invoked on a number of arguments
31     other than the number specified by its length property depends on the function.
32
33     this test needs a 1.2 version check.
34
35     http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
36
37
38     Author:             christine@netscape.com
39     Date:               12 november 1997
40 */
41
42     var SECTION = "15.3.5.1";
43     var VERSION = "ECMA_1";
44     startTest();
45     var TITLE   = "Function.length";
46     var BUGNUMBER="104204";
47
48     writeHeaderToLog( SECTION + " "+ TITLE);
49
50     var testcases = new Array();
51
52     var f = new Function( "a","b", "c", "return f.length");
53
54     testcases[tc++] = new TestCase( SECTION,
55         'var f = new Function( "a","b", "c", "return f.length"); f()',
56         3,
57         f() );
58
59
60     testcases[tc++] = new TestCase( SECTION,
61         'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
62         3,
63         f(1,2,3,4,5) );
64
65
66     test();
67
68 function test() {
69     for ( tc=0; tc < testcases.length; tc++ ) {
70         testcases[tc].passed = writeTestCaseResult(
71                             testcases[tc].expect,
72                             testcases[tc].actual,
73                             testcases[tc].description +" = "+
74                             testcases[tc].actual );
75
76         testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
77     }
78     stopTest();
79     return ( testcases );
80 }