Home | History | Annotate | Download | only in ExecutionContexts
      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.5-3.js
     24     ECMA Section:       10.1.5 Global Object
     25     Description:
     26     There is a unique global object which is created before control enters
     27     any execution context. Initially the global object has the following
     28     properties:
     29 
     30     Built-in objects such as Math, String, Date, parseInt, etc. These have
     31     attributes { DontEnum }.
     32 
     33     Additional host defined properties. This may include a property whose
     34     value is the global object itself, for example window in HTML.
     35 
     36     As control enters execution contexts, and as ECMAScript code is executed,
     37     additional properties may be added to the global object and the initial
     38     properties may be changed.
     39 
     40     Author:             christine (at) netscape.com
     41     Date:               12 november 1997
     42 */
     43     var SECTION = "10.5.1-3";
     44     var VERSION = "ECMA_1";
     45     startTest();
     46     writeHeaderToLog( SECTION + " Global Ojbect");
     47 
     48     var testcases = getTestCases();
     49 
     50     test();
     51 
     52 function test() {
     53     if ( Object == null ) {
     54         testcases[0].reason += " Object == null" ;
     55     }
     56     if ( Function == null ) {
     57         testcases[0].reason += " Function == null";
     58     }
     59     if ( String == null ) {
     60         testcases[0].reason += " String == null";
     61     }
     62     if ( Array == null ) {
     63         testcases[0].reason += " Array == null";
     64     }
     65     if ( Number == null ) {
     66         testcases[0].reason += " Function == null";
     67     }
     68     if ( Math == null ) {
     69         testcases[0].reason += " Math == null";
     70     }
     71     if ( Boolean == null ) {
     72         testcases[0].reason += " Boolean == null";
     73     }
     74     if ( Date  == null ) {
     75         testcases[0].reason += " Date == null";
     76     }
     77 /*
     78     if ( NaN == null ) {
     79         testcases[0].reason += " NaN == null";
     80     }
     81     if ( Infinity == null ) {
     82         testcases[0].reason += " Infinity == null";
     83     }
     84 */
     85     if ( eval == null ) {
     86         testcases[0].reason += " eval == null";
     87     }
     88     if ( parseInt == null ) {
     89         testcases[0].reason += " parseInt == null";
     90     }
     91 
     92     if ( testcases[0].reason != "" ) {
     93         testcases[0].actual = "fail";
     94     } else {
     95         testcases[0].actual = "pass";
     96     }
     97     testcases[0].expect = "pass";
     98 
     99     for ( tc=0; tc < testcases.length; tc++ ) {
    100 
    101         testcases[tc].passed = writeTestCaseResult(
    102                             testcases[tc].expect,
    103                             testcases[tc].actual,
    104                             testcases[tc].description +" = "+
    105                             testcases[tc].actual );
    106 
    107         testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
    108     }
    109     stopTest();
    110     return ( testcases );
    111 }
    112 function getTestCases() {
    113     var array = new Array();
    114     var item = 0;
    115 
    116     array[item++] = new TestCase( "SECTION", "Function Code check" );
    117 
    118     return ( array );
    119 }
    120