js/src/tests/ecma/ExecutionContexts/10.1.5-3.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: 10.1.5-3.js
michael@0 9 ECMA Section: 10.1.5 Global Object
michael@0 10 Description:
michael@0 11 There is a unique global object which is created before control enters
michael@0 12 any execution context. Initially the global object has the following
michael@0 13 properties:
michael@0 14
michael@0 15 Built-in objects such as Math, String, Date, parseInt, etc. These have
michael@0 16 attributes { DontEnum }.
michael@0 17
michael@0 18 Additional host defined properties. This may include a property whose
michael@0 19 value is the global object itself, for example window in HTML.
michael@0 20
michael@0 21 As control enters execution contexts, and as ECMAScript code is executed,
michael@0 22 additional properties may be added to the global object and the initial
michael@0 23 properties may be changed.
michael@0 24
michael@0 25 Author: christine@netscape.com
michael@0 26 Date: 12 november 1997
michael@0 27 */
michael@0 28 var SECTION = "10.5.1-3";
michael@0 29 var VERSION = "ECMA_1";
michael@0 30 startTest();
michael@0 31 writeHeaderToLog( SECTION + " Global Object");
michael@0 32
michael@0 33 new TestCase( "SECTION", "Function Code check" );
michael@0 34
michael@0 35 test();
michael@0 36
michael@0 37 function test() {
michael@0 38 if ( Object == null ) {
michael@0 39 gTestcases[0].reason += " Object == null" ;
michael@0 40 }
michael@0 41 if ( Function == null ) {
michael@0 42 gTestcases[0].reason += " Function == null";
michael@0 43 }
michael@0 44 if ( String == null ) {
michael@0 45 gTestcases[0].reason += " String == null";
michael@0 46 }
michael@0 47 if ( Array == null ) {
michael@0 48 gTestcases[0].reason += " Array == null";
michael@0 49 }
michael@0 50 if ( Number == null ) {
michael@0 51 gTestcases[0].reason += " Function == null";
michael@0 52 }
michael@0 53 if ( Math == null ) {
michael@0 54 gTestcases[0].reason += " Math == null";
michael@0 55 }
michael@0 56 if ( Boolean == null ) {
michael@0 57 gTestcases[0].reason += " Boolean == null";
michael@0 58 }
michael@0 59 if ( Date == null ) {
michael@0 60 gTestcases[0].reason += " Date == null";
michael@0 61 }
michael@0 62 /*
michael@0 63 if ( NaN == null ) {
michael@0 64 gTestcases[0].reason += " NaN == null";
michael@0 65 }
michael@0 66 if ( Infinity == null ) {
michael@0 67 gTestcases[0].reason += " Infinity == null";
michael@0 68 }
michael@0 69 */
michael@0 70 if ( eval == null ) {
michael@0 71 gTestcases[0].reason += " eval == null";
michael@0 72 }
michael@0 73 if ( parseInt == null ) {
michael@0 74 gTestcases[0].reason += " parseInt == null";
michael@0 75 }
michael@0 76
michael@0 77 if ( gTestcases[0].reason != "" ) {
michael@0 78 gTestcases[0].actual = "fail";
michael@0 79 } else {
michael@0 80 gTestcases[0].actual = "pass";
michael@0 81 }
michael@0 82 gTestcases[0].expect = "pass";
michael@0 83
michael@0 84 for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
michael@0 85
michael@0 86 gTestcases[gTc].passed = writeTestCaseResult(
michael@0 87 gTestcases[gTc].expect,
michael@0 88 gTestcases[gTc].actual,
michael@0 89 gTestcases[gTc].description +" = "+
michael@0 90 gTestcases[gTc].actual );
michael@0 91
michael@0 92 gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value ";
michael@0 93 }
michael@0 94 stopTest();
michael@0 95 return ( gTestcases );
michael@0 96 }

mercurial