summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/exec/u-lastindex-value.js
blob: 5c31efb0efd30a3fdef98a962925deb8ffef6352 (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: Definition of `lastIndex` property value
es6id: 21.2.5.2.2
info: |
    21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )

    [...]
    12. Let flags be the value of R’s [[OriginalFlags]] internal slot.
    13. If flags contains "u", let fullUnicode be true, else let fullUnicode be
        false.
    [...]
    16. Let e be r's endIndex value.
    17. If fullUnicode is true, then
        a. e is an index into the Input character list, derived from S, matched
           by matcher. Let eUTF be the smallest index into S that corresponds
           to the character at element e of Input. If e is greater than or
           equal to the length of Input, then eUTF is the number of code units
           in S.
        b. Let e be eUTF.
    18. If global is true or sticky is true,
        a. Let setStatus be Set(R, "lastIndex", e, true).
        b. ReturnIfAbrupt(setStatus).
---*/

var r = /./ug;
r.exec('𝌆');
assert.sameValue(r.lastIndex, 2);

reportCompare(0, 0);