1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma/ExecutionContexts/10.1.5-2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 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-2.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-2"; 1.32 +var VERSION = "ECMA_1"; 1.33 +startTest(); 1.34 + 1.35 +writeHeaderToLog( SECTION + " Global Object"); 1.36 + 1.37 +new TestCase( "SECTION", "Eval Code check" ); 1.38 + 1.39 +var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' + 1.40 + 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' + 1.41 + 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' + 1.42 + 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' + 1.43 + 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' + 1.44 + 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' + 1.45 + 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' + 1.46 + 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' + 1.47 + 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' + 1.48 + 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ; 1.49 + 1.50 +eval( EVAL_STRING ); 1.51 + 1.52 +/* 1.53 + if ( NaN == null ) { 1.54 + gTestcases[0].reason += " NaN == null"; 1.55 + } 1.56 + if ( Infinity == null ) { 1.57 + gTestcases[0].reason += " Infinity == null"; 1.58 + } 1.59 +*/ 1.60 + 1.61 +if ( gTestcases[0].reason != "" ) { 1.62 + gTestcases[0].actual = "fail"; 1.63 +} else { 1.64 + gTestcases[0].actual = "pass"; 1.65 +} 1.66 +gTestcases[0].expect = "pass"; 1.67 + 1.68 +test(); 1.69 +