summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.match/u-advance-after-empty.js
blob: 0b37aa21841e1ce5aabcdb9f5d4e110a8a617c43 (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
30
31
32
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: lastIndex is advanced according to width of astral symbols
es6id: 21.2.5.6
info: |
    21.2.5.6 RegExp.prototype [ @@match ] ( string )

    [...]
    8. Else global is true,
       a. Let fullUnicode be ToBoolean(Get(rx, "unicode")).
       [...]
       g. Repeat,
          [...]
          iv. Else result is not null,
              [...]
              5. If matchStr is the empty String, then
                 [...]
                 c. Let nextIndex be AdvanceStringIndex(S, thisIndex,
                    fullUnicode).
                 d. Let setStatus be Set(rx, "lastIndex", nextIndex, true).
features: [Symbol.match]
---*/

var match = /^|\udf06/ug[Symbol.match]('\ud834\udf06');

assert(match !== null);
assert.sameValue(match.length, 1);
assert.sameValue(match[0], '');

reportCompare(0, 0);