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