1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_8_5/regress/regress-yarr-regexp.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,20 @@ 1.4 +function toSource(o) { return o === null ? "null" : o.toSource(); } 1.5 + 1.6 +var gcgcz = /((?:.)+)((?:.)*)/; /* Greedy capture, greedy capture zero. */ 1.7 +reportCompare(["a", "a", ""].toSource(), gcgcz.exec("a").toSource()); 1.8 +reportCompare(["ab", "ab", ""].toSource(), gcgcz.exec("ab").toSource()); 1.9 +reportCompare(["abc", "abc", ""].toSource(), gcgcz.exec("abc").toSource()); 1.10 + 1.11 +reportCompare(["a", ""].toSource(), toSource(/((?:)*?)a/.exec("a"))); 1.12 +reportCompare(["a", ""].toSource(), toSource(/((?:.)*?)a/.exec("a"))); 1.13 +reportCompare(["a", ""].toSource(), toSource(/a((?:.)*)/.exec("a"))); 1.14 + 1.15 +reportCompare(["B", "B"].toSource(), toSource(/([A-Z])/.exec("fooBar"))); 1.16 + 1.17 +// These just mustn't crash. See bug 872971 1.18 +try { reportCompare(/x{2147483648}x/.test('1'), false); } catch (e) {} 1.19 +try { reportCompare(/x{2147483648,}x/.test('1'), false); } catch (e) {} 1.20 +try { reportCompare(/x{2147483647,2147483648}x/.test('1'), false); } catch (e) {} 1.21 +// Same for these. See bug 813366 1.22 +try { reportCompare("".match(/.{2147483647}11/), null); } catch (e) {} 1.23 +try { reportCompare("".match(/(?:(?=g)).{2147483648,}/ + ""), null); } catch (e) {}