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 = 414098; michael@0: var summary = 'Getter behavior on arrays'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: var a=[1,2,3]; michael@0: var foo = 44; michael@0: a.__defineGetter__(1, function() { return foo + 10; }); michael@0: actual = String(a); michael@0: reportCompare("1,54,3", actual, "getter 1"); michael@0: michael@0: actual = String(a.reverse()); michael@0: reportCompare("3,54,1", actual, "reverse"); michael@0: michael@0: var s = ""; michael@0: a.forEach(function(e) { s += e + "|"; }); michael@0: actual = s; michael@0: reportCompare("3|54|1|", actual, "forEach"); michael@0: michael@0: actual = a.join(' - '); michael@0: reportCompare("3 - 54 - 1", actual, "join"); michael@0: michael@0: a[2]=3; michael@0: actual = a.pop(); michael@0: reportCompare(actual, 3, "pop"); michael@0: michael@0: actual = a.pop(); michael@0: reportCompare(actual, 54, "pop 2");