From aab8a1ba3ac72fe1295969589b720e8e4191447e Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 28 Dec 2010 15:04:40 +0100 Subject: [PATCH] jscript: Better syntax error tests. --- dlls/jscript/tests/api.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index e4dc7c40e96..4b9f16035d1 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -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");