Try to fix jsreftest report results on win32.
[mozilla-central.git] / js / src / tests / ecma_5 / RegExp / regress-617935.js
blob2505ae640de354e1ab44424039ff7fafef228be7
1 /*
2  * Any copyright is dedicated to the Public Domain.
3  * http://creativecommons.org/licenses/publicdomain/
4  *
5  * Author: Christian Holler <decoder@own-hero.net>
6  */
8 /* Length of 32 */
9 var foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
11 /* Make len(foo) 32768 */
12 for (i = 0; i < 10; ++i) {
13     foo += foo;
16 /* Add one "a" to cause overflow later */
17 foo += "a";
19 var bar = "bbbbbbbbbbbbbbbb";
21 /* Make len(bar) 65536 */
22 for (i = 0; i < 12; ++i) {
23     bar += bar;
26 /* 
27  * Resulting string should be 
28  * len(foo)*len(bar) = (2^10 * 32 + 1) * 65536 = 2147549184 
29  * which will be negative as jsint
30  */
31 try {
32     foo.replace(/[a]/g, bar);
33 } catch (e) {
34     reportCompare(e instanceof InternalError, true, "Internal error due to overallocation is ok.");
36 reportCompare(true, true, "No crash occurred.");
38 print("All tests passed!");