js/src/tests/js1_2/function/length.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // |reftest| skip -- obsolete test
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 /**
     9    File Name:          15.3.5.1.js
    10    ECMA Section:       Function.length
    11    Description:
    13    The value of the length property is usually an integer that indicates the
    14    "typical" number of arguments expected by the function.  However, the
    15    language permits the function to be invoked with some other number of
    16    arguments. The behavior of a function when invoked on a number of arguments
    17    other than the number specified by its length property depends on the function.
    19    This checks the pre-ecma behavior Function.length.
    21    http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
    24    Author:             christine@netscape.com
    25    Date:               12 november 1997
    26 */
    28 var SECTION = "function/length.js";
    29 var VERSION = "ECMA_1";
    30 var TITLE   = "Function.length";
    31 var BUGNUMBER="104204";
    33 startTest();
    34 writeHeaderToLog( SECTION + " "+ TITLE);
    36 var f = new Function( "a","b", "c", "return f.length");
    38 if ( version() <= 120 ) {
    40   new TestCase( SECTION,
    41 		'var f = new Function( "a","b", "c", "return f.length"); f()',
    42 		0,
    43 		f() );
    45   new TestCase( SECTION,
    46 		'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
    47 		5,
    48 		f(1,2,3,4,5) );
    49 } else {
    51   new TestCase( SECTION,
    52 		'var f = new Function( "a","b", "c", "return f.length"); f()',
    53 		3,
    54 		f() );
    56   new TestCase( SECTION,
    57 		'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
    58 		3,
    59 		f(1,2,3,4,5) );
    62 }
    63 test();

mercurial