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-2.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-2"; 44 var VERSION = "ECMA_1"; 45 startTest(); 46 47 writeHeaderToLog( SECTION + " Global Ojbect"); 48 49 var testcases = getTestCases(); 50 51 var EVAL_STRING = 'if ( Object == null ) { testcases[0].reason += " Object == null" ; }' + 52 'if ( Function == null ) { testcases[0].reason += " Function == null"; }' + 53 'if ( String == null ) { testcases[0].reason += " String == null"; }' + 54 'if ( Array == null ) { testcases[0].reason += " Array == null"; }' + 55 'if ( Number == null ) { testcases[0].reason += " Function == null";}' + 56 'if ( Math == null ) { testcases[0].reason += " Math == null"; }' + 57 'if ( Boolean == null ) { testcases[0].reason += " Boolean == null"; }' + 58 'if ( Date == null ) { testcases[0].reason += " Date == null"; }' + 59 'if ( eval == null ) { testcases[0].reason += " eval == null"; }' + 60 'if ( parseInt == null ) { testcases[0].reason += " parseInt == null"; }' ; 61 62 eval( EVAL_STRING ); 63 64 /* 65 if ( NaN == null ) { 66 testcases[0].reason += " NaN == null"; 67 } 68 if ( Infinity == null ) { 69 testcases[0].reason += " Infinity == null"; 70 } 71 */ 72 73 if ( testcases[0].reason != "" ) { 74 testcases[0].actual = "fail"; 75 } else { 76 testcases[0].actual = "pass"; 77 } 78 testcases[0].expect = "pass"; 79 80 test(); 81 82 function test() { 83 for ( tc=0; tc < testcases.length; tc++ ) { 84 testcases[tc].passed = writeTestCaseResult( 85 testcases[tc].expect, 86 testcases[tc].actual, 87 testcases[tc].description +" = "+ 88 testcases[tc].actual + " "+ 89 testcases[tc].reason ); 90 } 91 stopTest(); 92 return ( testcases ); 93 } 94 function getTestCases() { 95 var array = new Array(); 96 var item = 0; 97 98 array[item++] = new TestCase( "SECTION", "Eval Code check" ); 99 100 return ( array ); 101 } 102