summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/RegExp/prototype/Symbol.search/set-lastindex-init.js
blob: 17360b72f6e0984d12e0b0d36564a55d0d9cd9aa (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
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es6id: 21.2.5.9
description: >
    The `lastIndex` value is set to 0 immediately prior to match execution
info: |
    [...]
    7. Let status be Set(rx, "lastIndex", 0, true).
    8. ReturnIfAbrupt(status).
    9. Let result be RegExpExec(rx, S).
    [...]
features: [Symbol.search]
---*/

var duringExec;
var fakeRe = {
  lastIndex: 34,
  exec: function() {
    duringExec = fakeRe.lastIndex;
    return null;
  }
};

RegExp.prototype[Symbol.search].call(fakeRe);

assert.sameValue(duringExec, 0);

reportCompare(0, 0);