blob: a7a909fe7262bcef568d4c7472ce2318f7cd1f79 (
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) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-regexp.prototype-@@search
description: >
`currentLastIndex` value is compared using SameValue.
info: |
RegExp.prototype [ @@search ] ( string )
[...]
6. Let result be ? RegExpExec(rx, S).
7. Let currentLastIndex be ? Get(rx, "lastIndex").
8. If SameValue(currentLastIndex, previousLastIndex) is false, then
a. Perform ? Set(rx, "lastIndex", previousLastIndex, true).
[...]
features: [Symbol.search]
---*/
var re = /(?:)/;
re.exec = function() {
re.lastIndex = -0;
return null;
};
assert.sameValue(re[Symbol.search](""), -1);
assert.sameValue(re.lastIndex, 0);
reportCompare(0, 0);
|