Debian Codegraph @

rhino/testsrc/tests/js1_5/extensions/regress-220584.js

raw symbols SCIP
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 * Date: 29 Sep 2003
9 * SUMMARY: Testing __parent__ and __proto__ of Script object
10 *
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=220584
12 */
13 //-----------------------------------------------------------------------------
14 var gTestfile = 'regress-220584.js';
15 var UBound = 0;
16 var BUGNUMBER = 220584;
17 var summary = 'Testing __parent__ and __proto__ of Script object';
18 var status = '';
19 var statusitems = [];
20 var actual = '';
21 var actualvalues = [];
22 var expect= '';
23 var expectedvalues = [];
24 var s;
25
26
27 // invoke |Script| as a function
28 status = inSection(1);
29 if (typeof Script == 'undefined')
30 {
31 reportCompare("Script not defined, Test skipped.",
32 "Script not defined, Test skipped.",
33 summary);
34 }
35 else
36 {
37 s = Script('1;');
38 actual = s instanceof Object;
39 expect = true;
40 addThis();
41
42 status = inSection(2);
43 actual = (s.__parent__ == undefined) || (s.__parent__ == null);
44 expect = false;
45 addThis();
46
47 status = inSection(3);
48 actual = (s.__proto__ == undefined) || (s.__proto__ == null);
49 expect = false;
50 addThis();
51
52 status = inSection(4);
53 actual = (s + '').length > 0;
54 expect = true;
55 addThis();
56
57 }
58
59 // invoke |Script| as a constructor
60 status = inSection(5);
61 if (typeof Script == 'undefined')
62 {
63 print('Test skipped. Script not defined.');
64 }
65 else
66 {
67 s = new Script('1;');
68
69 actual = s instanceof Object;
70 expect = true;
71 addThis();
72
73 status = inSection(6);
74 actual = (s.__parent__ == undefined) || (s.__parent__ == null);
75 expect = false;
76 addThis();
77
78 status = inSection(7);
79 actual = (s.__proto__ == undefined) || (s.__proto__ == null);
80 expect = false;
81 addThis();
82
83 status = inSection(8);
84 actual = (s + '').length > 0;
85 expect = true;
86 addThis();
87 }
88
89 //-----------------------------------------------------------------------------
90 test();
91 //-----------------------------------------------------------------------------
92
93 function addThis()
94 {
95 statusitems[UBound] = status;
96 actualvalues[UBound] = actual;
97 expectedvalues[UBound] = expect;
98 UBound++;
99 }
100
101
102 function test()
103 {
104 enterFunc('test');
105 printBugNumber(BUGNUMBER);
106 printStatus(summary);
107
108 for (var i=0; i<UBound; i++)
109 {
110 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
111 }
112
113 exitFunc ('test');
114 }