js/src/tests/js1_8_5/regress/regress-yarr-regexp.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 function toSource(o) { return o === null ? "null" : o.toSource(); }
michael@0 2
michael@0 3 var gcgcz = /((?:.)+)((?:.)*)/; /* Greedy capture, greedy capture zero. */
michael@0 4 reportCompare(["a", "a", ""].toSource(), gcgcz.exec("a").toSource());
michael@0 5 reportCompare(["ab", "ab", ""].toSource(), gcgcz.exec("ab").toSource());
michael@0 6 reportCompare(["abc", "abc", ""].toSource(), gcgcz.exec("abc").toSource());
michael@0 7
michael@0 8 reportCompare(["a", ""].toSource(), toSource(/((?:)*?)a/.exec("a")));
michael@0 9 reportCompare(["a", ""].toSource(), toSource(/((?:.)*?)a/.exec("a")));
michael@0 10 reportCompare(["a", ""].toSource(), toSource(/a((?:.)*)/.exec("a")));
michael@0 11
michael@0 12 reportCompare(["B", "B"].toSource(), toSource(/([A-Z])/.exec("fooBar")));
michael@0 13
michael@0 14 // These just mustn't crash. See bug 872971
michael@0 15 try { reportCompare(/x{2147483648}x/.test('1'), false); } catch (e) {}
michael@0 16 try { reportCompare(/x{2147483648,}x/.test('1'), false); } catch (e) {}
michael@0 17 try { reportCompare(/x{2147483647,2147483648}x/.test('1'), false); } catch (e) {}
michael@0 18 // Same for these. See bug 813366
michael@0 19 try { reportCompare("".match(/.{2147483647}11/), null); } catch (e) {}
michael@0 20 try { reportCompare("".match(/(?:(?=g)).{2147483648,}/ + ""), null); } catch (e) {}

mercurial