summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/String/lastIndexOf-ToNumber-when-searchStr-larger-than-string.js
blob: a4c3c316e07bf18c335e931efe15fdd587095fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var str = "a";
var searchStr = "abc";

var position = new Object();
var valueOfCalled = false;
function positionValueOf() {
    assertEq(valueOfCalled, false);
    valueOfCalled = true;
    return 0;
}
position.valueOf = positionValueOf;

var result = str.lastIndexOf(searchStr, position);
assertEq(result, -1);
assertEq(valueOfCalled, true);

if (typeof reportCompare == "function")
    reportCompare(0, 0);