jscript: Better syntax error tests.

This commit is contained in:
Jacek Caban 2010-12-28 15:04:40 +01:00 committed by Alexandre Julliard
parent 519c288946
commit aab8a1ba3a
1 changed files with 14 additions and 2 deletions

View File

@ -1954,9 +1954,21 @@ testException(function() {new VBArray(new VBArray(createArray()));}, "E_NOT_VBAR
testException(function() {VBArray.prototype.lbound.call(new Object());}, "E_NOT_VBARRAY");
// SyntaxError tests
function testSyntaxError(code, e) {
testException(function() { eval(code); }, e);
function testSyntaxError(code, id) {
var ex = exception_array[id];
var ret = "", num = "";
try {
eval(code);
} catch(e) {
ret = e.name;
num = e.number;
}
ok(ret === ex.type, "Syntax exception test, ret = " + ret + ", expected " + ex.type +". Executed code: " + code);
ok(num === ex.number, "Syntax exception test, num = " + num + ", expected " + ex.number + ". Executed code: " + code);
}
testSyntaxError("for(i=0;) {}", "E_SYNTAX_ERROR");
testSyntaxError("function {};", "E_LBRACKET");
testSyntaxError("if", "E_LBRACKET");