Skip stress/regexp-unicode-surrogate-pair-increment-should-involve-length-check.js...
[WebKit-https.git] / JSTests / stress / regexp-unicode-surrogate-pair-increment-should-involve-length-check.js
1 //@ skip if ["arm", "mips"].include?($architecture)
2 // This test checks for proper incrementing around / over individual surrogates and surrogate pairs.
3 // This test should run without crashing.
4
5 function testRegExpMatch(re, str)
6 {
7     for (let i = 0; i < 100; ++i) {
8         let match = re.exec(str);
9         if (!match || match[0] != str) {
10             print(match);
11             throw "Expected " + re + " to match \"" + str + "\" but it didn't";
12         }
13     }
14 }
15
16 let testString = "\ud800\ud800\udc00";
17 let greedyRegExp = /([^x]+)[^]*\1([^])/u;
18
19 testRegExpMatch(greedyRegExp, testString);
20
21 let nonGreedyRegExp = /(.*[^x]+?)[^]*([^])/u;
22
23 testRegExpMatch(nonGreedyRegExp, testString);
24
25 let testString2 = "\ud800\ud800\udc00Test\udc00123";
26 let backtrackGreedyRegExp = /.*[\x20-\udffff].\w*.\d{3}/u;
27
28 testRegExpMatch(backtrackGreedyRegExp, testString2);