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 = 415451; michael@0: var summary = 'indexOf/lastIndexOf behavior'; michael@0: michael@0: var expected = "3,0,3,3,3,-1,-1"; michael@0: results = []; michael@0: var a = [1,2,3,1]; michael@0: for (var i=-1; i < a.length+2; i++) michael@0: results.push(a.indexOf(1,i)); michael@0: var actual = String(results); michael@0: reportCompare(expected, actual, "indexOf"); michael@0: michael@0: results = []; michael@0: var expected = "3,0,0,0,3,3,3"; michael@0: for (var i=-1; i < a.length+2; i++) michael@0: results.push(a.lastIndexOf(1,i)); michael@0: var actual = String(results); michael@0: reportCompare(expected, actual, "lastIndexOf"); michael@0: