Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/RegExp/lookBehind/sliced-strings.js

raw
1 // Copyright (C) 2017 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-assertion
6 description: Sliced strings
7 info: |
8 Rationale from https://github.com/tc39/test262/pull/999#discussion_r113807747
9
10 Since this test originates from V8, this targets V8's sliced strings, which are used for
11 substrings above a length of 13 characters. I wrote this test for exactly the reason
12 @littledan mentioned. That's why the variable name is called oob_subject. The underlying string
13 backing store extends beyond the actual boundary of the sliced string.
14 features: [regexp-lookbehind]
15 ---*/
16
17 var oob_subject = "abcdefghijklmnabcdefghijklmn".substr(14);
18 assert.sameValue(oob_subject.match(/(?=(abcdefghijklmn))(?<=\1)a/i), null, "");
19 assert.sameValue(oob_subject.match(/(?=(abcdefghijklmn))(?<=\1)a/), null, "");
20 assert.sameValue("abcdefgabcdefg".substr(1).match(/(?=(abcdefg))(?<=\1)/), null, "");