]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/mozilla/js1_5/Regress/regress-68498-003.js
JavaScriptCore-521.tar.gz
[apple/javascriptcore.git] / tests / mozilla / js1_5 / Regress / regress-68498-003.js
CommitLineData
b37bf2e1
A
1/*
2* The contents of this file are subject to the Netscape Public
3* License Version 1.1 (the "License"); you may not use this file
4* except in compliance with the License. You may obtain a copy of
5* the License at http://www.mozilla.org/NPL/
6*
7* Software distributed under the License is distributed on an "AS
8* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9* implied. See the License for the specific language governing
10* rights and limitations under the License.
11*
12* The Original Code is mozilla.org code.
13*
14* The Initial Developer of the Original Code is Netscape
15* Communications Corporation. Portions created by Netscape are
16* Copyright (C) 1998 Netscape Communications Corporation. All
17* Rights Reserved.
18*
19* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
20* Date: 15 Feb 2001
21*
22* SUMMARY: calling obj.eval(str)
23*
24* See http://bugzilla.mozilla.org/show_bug.cgi?id=68498
25* See http://bugzilla.mozilla.org/showattachment.cgi?attach_id=25251
26*
27* Brendan:
28*
29* "Backward compatibility: support calling obj.eval(str), which evaluates
30* str using obj as the scope chain and variable object."
31*/
32//-------------------------------------------------------------------------------------------------
33var bug = 68498;
34var summary = 'Testing calling obj.eval(str)';
35var statprefix = '; currently at expect[';
36var statsuffix = '] within test -';
37var actual = [ ];
38var expect = [ ];
39
40
41// Capture a reference to the global object -
42var self = this;
43
44// This function is the heart of the test -
45function f(s) {self.eval(s); return y;}
46
47
48// Set the actual-results array -
49actual[0] = f('var y = 43');
50actual[1] = 'y' in self && y;
51actual[2] = delete y;
52actual[3] = 'y' in self;
53
54// Set the expected-results array -
55expect[0] = 43;
56expect[1] = 43;
57expect[2] = true;
58expect[3] = false;
59
60
61//-------------------------------------------------------------------------------------------------
62test();
63//-------------------------------------------------------------------------------------------------
64
65
66function test()
67{
68 enterFunc ('test');
69 printBugNumber (bug);
70 printStatus (summary);
71
72 for (var i in expect)
73 {
74 reportCompare(expect[i], actual[i], getStatus(i));
75 }
76
77 exitFunc ('test');
78}
79
80
81function getStatus(i)
82{
83 return (summary + statprefix + i + statsuffix);
84}