Home | History | Annotate | Download | only in Regress
      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:          function-001.js
     24  *  Description:
     25  *
     26  * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=325843
     27  * js> function f(a){var a,b;}
     28  *
     29  * causes an an assert on a null 'sprop' in the 'Variables' function in
     30  * jsparse.c This will crash non-debug build.
     31  *
     32  *  Author:             christine (at) netscape.com
     33  *  Date:               11 August 1998
     34  */
     35     var SECTION = "function-001.js";
     36     var VERSION = "JS1_4";
     37     var TITLE   = "Regression test case for 325843";
     38     var BUGNUMBER="3258435";
     39     startTest();
     40 
     41     writeHeaderToLog( SECTION + " "+ TITLE);
     42 
     43     var testcases = new Array();
     44 
     45     eval("function f1 (a){ var a,b; }");
     46 
     47     function f2( a ) { var a, b; };
     48 
     49     testcases[tc++] = new TestCase(
     50         SECTION,
     51         "eval(\"function f1 (a){ var a,b; }\"); "+
     52         "function f2( a ) { var a, b; }; typeof f1",
     53         "function",
     54         typeof f1 );
     55 
     56     // force a function decompilation
     57 
     58     testcases[tc++] = new TestCase(
     59         SECTION,
     60         "typeof f1.toString()",
     61         "string",
     62         typeof f1.toString() );
     63 
     64     testcases[tc++] = new TestCase(
     65         SECTION,
     66         "typeof f2",
     67         "function",
     68         typeof f2 );
     69 
     70     // force a function decompilation
     71 
     72     testcases[tc++] = new TestCase(
     73         SECTION,
     74         "typeof f2.toString()",
     75         "string",
     76         typeof f2.toString() );
     77 
     78     test();
     79 
     80