summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/match-failure.js
blob: a0d5317e5b0fec9670494233c752c05153f50aa1 (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
25
26
27
28
29
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Return original string when no matches occur
es6id: 21.2.5.8
info: |
    21.2.5.8 RegExp.prototype [ @@replace ] ( string, replaceValue )

    [...]
    12. Let done be false.
    13. Repeat, while done is false
        a. Let result be RegExpExec(rx, S).
        b. ReturnIfAbrupt(result).
        c. If result is null, set done to true.
        [...]
    14. Let accumulatedResult be the empty String value.
    15. Let nextSourcePosition be 0.
    [...]
    18. Return the String formed by concatenating the code units of
        accumulatedResult with the substring of S consisting of the code units
        from nextSourcePosition (inclusive) up through the final code unit of S
        (inclusive).
features: [Symbol.replace]
---*/

assert.sameValue(/x/[Symbol.replace]('abc', 'X'), 'abc');

reportCompare(0, 0);