michael@0: // |reftest| skip -- obsolete test michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 320119; michael@0: var summary = 'delegating objects and arguments, arity, caller, name'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: printStatus('original test'); michael@0: michael@0: function origtest(name, bar) michael@0: { michael@0: this.name = name; michael@0: this.bar = bar; michael@0: } michael@0: michael@0: function Monty(id, name, bar) michael@0: { michael@0: this.id = id; michael@0: this.base = origtest; michael@0: this.base(name, bar); michael@0: } michael@0: michael@0: Monty.prototype = origtest; michael@0: michael@0: function testtwo(notNamedName, bar) michael@0: { michael@0: this.name = notNamedName; michael@0: this.bar = bar; michael@0: } michael@0: michael@0: function Python(id, notNamedName, bar) michael@0: { michael@0: this.id = id; michael@0: this.base = origtest; michael@0: this.base(notNamedName, bar); michael@0: } michael@0: michael@0: Python.prototype = testtwo; michael@0: michael@0: var foo = new Monty(1, 'my name', 'sna!'); michael@0: michael@0: var manchu = new Python(1, 'my name', 'sna!'); michael@0: michael@0: printStatus('foo.name: ' + foo.name); michael@0: printStatus('manchu.name: ' + manchu.name); michael@0: michael@0: expect = 'my name:my name'; michael@0: actual = foo.name + ':' + manchu.name; michael@0: reportCompare(expect, actual, summary + ': override function..name'); michael@0: michael@0: // end original test michael@0: michael@0: printStatus('test shared properties'); michael@0: michael@0: function testshared() michael@0: { michael@0: } michael@0: michael@0: expect = false; michael@0: actual = testshared.hasOwnProperty('arguments'); michael@0: reportCompare(expect, actual, summary + ': arguments no longer shared'); michael@0: michael@0: expect = false; michael@0: actual = testshared.hasOwnProperty('caller'); michael@0: reportCompare(expect, actual, summary + ': caller no longer shared'); michael@0: michael@0: expect = false; michael@0: actual = testshared.hasOwnProperty('arity'); michael@0: reportCompare(expect, actual, summary + ': arity no longer shared'); michael@0: michael@0: expect = false; michael@0: actual = testshared.hasOwnProperty('name'); michael@0: reportCompare(expect, actual, summary + ': name no longer shared'); michael@0: michael@0: expect = true; michael@0: actual = testshared.hasOwnProperty('length'); michael@0: reportCompare(expect, actual, summary + ': length still shared'); michael@0: michael@0: printStatus('test overrides'); michael@0: michael@0: function Parent() michael@0: { michael@0: this.arguments = 'oarguments'; michael@0: this.caller = 'ocaller'; michael@0: this.arity = 'oarity'; michael@0: this.length = 'olength'; michael@0: this.name = 'oname'; michael@0: } michael@0: michael@0: function Child() michael@0: { michael@0: this.base = Parent; michael@0: this.base(); michael@0: } michael@0: michael@0: Child.prototype = Parent; michael@0: michael@0: Child.prototype.value = function() michael@0: { michael@0: return this.arguments + ',' + this.caller + ',' + this.arity + ',' + michael@0: this.length + ',' + this.name; michael@0: }; michael@0: michael@0: var child = new Child(); michael@0: michael@0: expect = 'oarguments,ocaller,oarity,0,oname'; michael@0: actual = child.value(); michael@0: reportCompare(expect, actual, summary + ': overrides');