summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.replace/replace-without-trailing.js
blob: e52de7ba56ef79654beb9ea877e838ecfcfd7496 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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 value when replacement pattern matches final code point
es6id: 21.2.5.8
info: |
    [...]
    17. If nextSourcePosition ≥ lengthS, return accumulatedResult.
features: [Symbol.replace]
---*/

assert.sameValue(/abcd/[Symbol.replace]('abcd', 'X'), 'X');
assert.sameValue(/bcd/[Symbol.replace]('abcd', 'X'), 'aX');
assert.sameValue(/cd/[Symbol.replace]('abcd', 'X'), 'abX');
assert.sameValue(/d/[Symbol.replace]('abcd', 'X'), 'abcX');

reportCompare(0, 0);