зеркало из https://github.com/mozilla/pjs.git
Revising test to match style of testcase for duplicate bug 192414. That is, use an eval string and try...catch. See bug 192414 comment 25 etc. -
This commit is contained in:
Родитель
49fba3aed7
Коммит
98eb5b9431
|
@ -40,210 +40,82 @@
|
|||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
var UBound = 0;
|
||||
var bug = 152646;
|
||||
var summary = 'Testing expressions with large numbers of parentheses';
|
||||
|
||||
printBugNumber(bug);
|
||||
printStatus(summary);
|
||||
var status = '';
|
||||
var statusitems = [];
|
||||
var actual = '';
|
||||
var actualvalues = [];
|
||||
var expect= '';
|
||||
var expectedvalues = [];
|
||||
|
||||
|
||||
/*
|
||||
* Just seeing that we don't crash when compiling this assignment -
|
||||
*
|
||||
* We will form an eval string to set the result-variable |actual|.
|
||||
* To get a feel for this, suppose N were 3. Then the eval string is
|
||||
* 'actual = (((0)));' The expected value for this after eval() is 0.
|
||||
*/
|
||||
var len =
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
|
||||
(((((((((((((((((((((((((((((((((((((((((((((((((((
|
||||
(((((((((((((
|
||||
status = inSection(1);
|
||||
|
||||
0
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
|
||||
)))))))))))))))))))))))))))))))))))))))))))))))))))
|
||||
)))))))))))))
|
||||
var sLeft = '((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((';
|
||||
sLeft += sLeft;
|
||||
sLeft += sLeft;
|
||||
sLeft += sLeft;
|
||||
sLeft += sLeft;
|
||||
sLeft += sLeft;
|
||||
|
||||
;
|
||||
var sRight = '))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
|
||||
sRight += sRight;
|
||||
sRight += sRight;
|
||||
sRight += sRight;
|
||||
sRight += sRight;
|
||||
|
||||
var sEval = 'actual = ' + sLeft + '0' + sRight;
|
||||
try
|
||||
{
|
||||
eval(sEval);
|
||||
}
|
||||
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 = 0;
|
||||
}
|
||||
expect = 0;
|
||||
addThis();
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
test();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
function addThis()
|
||||
{
|
||||
statusitems[UBound] = status;
|
||||
actualvalues[UBound] = actual;
|
||||
expectedvalues[UBound] = expect;
|
||||
UBound++;
|
||||
}
|
||||
|
||||
|
||||
function test()
|
||||
{
|
||||
enterFunc('test');
|
||||
printBugNumber(bug);
|
||||
printStatus(summary);
|
||||
|
||||
for (var i=0; i<UBound; i++)
|
||||
{
|
||||
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче