]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/js1_2/function/length.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/
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.
11 * The Original Code is Mozilla Communicator client code, released March
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
23 File Name: 15.3.5.1.js
24 ECMA Section: Function.length
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.
33 This checks the pre-ecma behavior Function.length.
35 http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
38 Author: christine@netscape.com
39 Date: 12 november 1997
42 var SECTION
= "function/length.js";
43 var VERSION
= "ECMA_1";
45 var TITLE
= "Function.length";
46 var BUGNUMBER
="104204";
48 writeHeaderToLog( SECTION
+ " "+ TITLE
);
50 var testcases
= new Array();
52 var f
= new Function( "a","b", "c", "return f.length");
54 if ( version() <= 120 ) {
56 testcases
[tc
++] = new TestCase( SECTION
,
57 'var f = new Function( "a","b", "c", "return f.length"); f()',
61 testcases
[tc
++] = new TestCase( SECTION
,
62 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
67 testcases
[tc
++] = new TestCase( SECTION
,
68 'var f = new Function( "a","b", "c", "return f.length"); f()',
72 testcases
[tc
++] = new TestCase( SECTION
,
73 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
82 for ( tc
=0; tc
< testcases
.length
; tc
++ ) {
83 testcases
[tc
].passed
= writeTestCaseResult(
86 testcases
[tc
].description
+" = "+
87 testcases
[tc
].actual
);
89 testcases
[tc
].reason
+= ( testcases
[tc
].passed
) ? "" : "wrong value ";