js/src/tests/js1_5/Regress/regress-320119.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:751cd9c62296
1 // |reftest| skip -- obsolete test
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 320119;
9 var summary = 'delegating objects and arguments, arity, caller, name';
10 var actual = '';
11 var expect = '';
12
13 printBugNumber(BUGNUMBER);
14 printStatus (summary);
15
16 printStatus('original test');
17
18 function origtest(name, bar)
19 {
20 this.name = name;
21 this.bar = bar;
22 }
23
24 function Monty(id, name, bar)
25 {
26 this.id = id;
27 this.base = origtest;
28 this.base(name, bar);
29 }
30
31 Monty.prototype = origtest;
32
33 function testtwo(notNamedName, bar)
34 {
35 this.name = notNamedName;
36 this.bar = bar;
37 }
38
39 function Python(id, notNamedName, bar)
40 {
41 this.id = id;
42 this.base = origtest;
43 this.base(notNamedName, bar);
44 }
45
46 Python.prototype = testtwo;
47
48 var foo = new Monty(1, 'my name', 'sna!');
49
50 var manchu = new Python(1, 'my name', 'sna!');
51
52 printStatus('foo.name: ' + foo.name);
53 printStatus('manchu.name: ' + manchu.name);
54
55 expect = 'my name:my name';
56 actual = foo.name + ':' + manchu.name;
57 reportCompare(expect, actual, summary + ': override function..name');
58
59 // end original test
60
61 printStatus('test shared properties');
62
63 function testshared()
64 {
65 }
66
67 expect = false;
68 actual = testshared.hasOwnProperty('arguments');
69 reportCompare(expect, actual, summary + ': arguments no longer shared');
70
71 expect = false;
72 actual = testshared.hasOwnProperty('caller');
73 reportCompare(expect, actual, summary + ': caller no longer shared');
74
75 expect = false;
76 actual = testshared.hasOwnProperty('arity');
77 reportCompare(expect, actual, summary + ': arity no longer shared');
78
79 expect = false;
80 actual = testshared.hasOwnProperty('name');
81 reportCompare(expect, actual, summary + ': name no longer shared');
82
83 expect = true;
84 actual = testshared.hasOwnProperty('length');
85 reportCompare(expect, actual, summary + ': length still shared');
86
87 printStatus('test overrides');
88
89 function Parent()
90 {
91 this.arguments = 'oarguments';
92 this.caller = 'ocaller';
93 this.arity = 'oarity';
94 this.length = 'olength';
95 this.name = 'oname';
96 }
97
98 function Child()
99 {
100 this.base = Parent;
101 this.base();
102 }
103
104 Child.prototype = Parent;
105
106 Child.prototype.value = function()
107 {
108 return this.arguments + ',' + this.caller + ',' + this.arity + ',' +
109 this.length + ',' + this.name;
110 };
111
112 var child = new Child();
113
114 expect = 'oarguments,ocaller,oarity,0,oname';
115 actual = child.value();
116 reportCompare(expect, actual, summary + ': overrides');

mercurial