summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex.js
blob: ea824178e8d2233cb81cf9446c4de9c5deeeb9cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Initialization of `lastIndex` property for "global" instances
es6id: 21.2.5.8
info: |
    21.2.5.8 RegExp.prototype [ @@replace ] ( string, replaceValue )

    [...]
    10. If global is true, then
        [...]
        c. Let setStatus be Set(rx, "lastIndex", 0, true).
        [...]
features: [Symbol.replace]
---*/

var r = /./g;

r.lastIndex = 1;

assert.sameValue(r[Symbol.replace]('aa', 'x'), 'xx');

reportCompare(0, 0);