1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/ExecutionContexts/10.1.5-3.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,96 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +/** 1.11 + File Name: 10.1.5-3.js 1.12 + ECMA Section: 10.1.5 Global Object 1.13 + Description: 1.14 + There is a unique global object which is created before control enters 1.15 + any execution context. Initially the global object has the following 1.16 + properties: 1.17 + 1.18 + Built-in objects such as Math, String, Date, parseInt, etc. These have 1.19 + attributes { DontEnum }. 1.20 + 1.21 + Additional host defined properties. This may include a property whose 1.22 + value is the global object itself, for example window in HTML. 1.23 + 1.24 + As control enters execution contexts, and as ECMAScript code is executed, 1.25 + additional properties may be added to the global object and the initial 1.26 + properties may be changed. 1.27 + 1.28 + Author: christine@netscape.com 1.29 + Date: 12 november 1997 1.30 +*/ 1.31 +var SECTION = "10.5.1-3"; 1.32 +var VERSION = "ECMA_1"; 1.33 +startTest(); 1.34 +writeHeaderToLog( SECTION + " Global Object"); 1.35 + 1.36 +new TestCase( "SECTION", "Function Code check" ); 1.37 + 1.38 +test(); 1.39 + 1.40 +function test() { 1.41 + if ( Object == null ) { 1.42 + gTestcases[0].reason += " Object == null" ; 1.43 + } 1.44 + if ( Function == null ) { 1.45 + gTestcases[0].reason += " Function == null"; 1.46 + } 1.47 + if ( String == null ) { 1.48 + gTestcases[0].reason += " String == null"; 1.49 + } 1.50 + if ( Array == null ) { 1.51 + gTestcases[0].reason += " Array == null"; 1.52 + } 1.53 + if ( Number == null ) { 1.54 + gTestcases[0].reason += " Function == null"; 1.55 + } 1.56 + if ( Math == null ) { 1.57 + gTestcases[0].reason += " Math == null"; 1.58 + } 1.59 + if ( Boolean == null ) { 1.60 + gTestcases[0].reason += " Boolean == null"; 1.61 + } 1.62 + if ( Date == null ) { 1.63 + gTestcases[0].reason += " Date == null"; 1.64 + } 1.65 +/* 1.66 + if ( NaN == null ) { 1.67 + gTestcases[0].reason += " NaN == null"; 1.68 + } 1.69 + if ( Infinity == null ) { 1.70 + gTestcases[0].reason += " Infinity == null"; 1.71 + } 1.72 +*/ 1.73 + if ( eval == null ) { 1.74 + gTestcases[0].reason += " eval == null"; 1.75 + } 1.76 + if ( parseInt == null ) { 1.77 + gTestcases[0].reason += " parseInt == null"; 1.78 + } 1.79 + 1.80 + if ( gTestcases[0].reason != "" ) { 1.81 + gTestcases[0].actual = "fail"; 1.82 + } else { 1.83 + gTestcases[0].actual = "pass"; 1.84 + } 1.85 + gTestcases[0].expect = "pass"; 1.86 + 1.87 + for ( gTc=0; gTc < gTestcases.length; gTc++ ) { 1.88 + 1.89 + gTestcases[gTc].passed = writeTestCaseResult( 1.90 + gTestcases[gTc].expect, 1.91 + gTestcases[gTc].actual, 1.92 + gTestcases[gTc].description +" = "+ 1.93 + gTestcases[gTc].actual ); 1.94 + 1.95 + gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; 1.96 + } 1.97 + stopTest(); 1.98 + return ( gTestcases ); 1.99 +}