Add a try...catch around the recursion test to catch 'too much recursion' exceptions. They are OK; we are only testing against crashes in this test.

This commit is contained in:
pschwartau%netscape.com 2003-02-24 20:04:07 +00:00
parent b757fa1a10
commit 67070c0aad
3 changed files with 31 additions and 5 deletions

View File

@ -50,8 +50,10 @@ printStatus(summary);
/*
* Just seeing that we don't crash when compiling this assignment -
*/
var len =
try
{
var len =
(((((((((((((((((((((((((((((((((((((((((((((((((((
(((((((((((((
@ -247,3 +249,8 @@ var len =
)))))))))))))
;
}
catch(e)
{
}

View File

@ -61,7 +61,18 @@ var N = 10000;
var left = repeat_str('(1&', N);
var right = repeat_str(')', N);
var str = 'actual = '.concat(left, '1', right, ';');
eval(str);
try
{
eval(str);
}
catch (e)
{
/*
* An exception during this eval is OK, as the runtime can throw one
* in response to too deep recursion. We haven't crashed; good!
*/
actual = 1;
}
expect = 1;
addThis();

View File

@ -57,8 +57,16 @@ var expectedvalues = [];
* Set both |actual| and |expect| to a dummy value.
*/
status = inSection(1);
var N = 100;
var str = make_deep_nest(N);
var N = 1000;
try
{
make_deep_nest(N);
}
catch (e)
{
// An exception is OK, as the runtime can throw one in response to too deep
// recursion. We haven't crashed; good! Continue on to set the dummy values -
}
actual = 1;
expect = 1;
addThis();