Debian Codegraph @

rhino/testsrc/tests/js1_6/Array/regress-415451.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 var gTestfile = 'regress-415451.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 415451;
9 var summary = 'indexOf/lastIndexOf behavior';
10
11 var expected = "3,0,3,3,3,-1,-1";
12 results = [];
13 var a = [1,2,3,1];
14 for (var i=-1; i < a.length+2; i++)
15 results.push(a.indexOf(1,i));
16 var actual = String(results);
17 reportCompare(expected, actual, "indexOf");
18
19 results = [];
20 var expected = "3,0,0,0,3,3,3";
21 for (var i=-1; i < a.length+2; i++)
22 results.push(a.lastIndexOf(1,i));
23 var actual = String(results);
24 reportCompare(expected, actual, "lastIndexOf");
25