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

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

mercurial