Commit 10b1a7ed authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added conditional compilation tests.

parent 45e33ec2
......@@ -1899,6 +1899,7 @@ var exception_array = {
E_RBRACKET: { type: "SyntaxError", number: -2146827282 },
E_SEMICOLON: { type: "SyntaxError", number: -2146827284 },
E_UNTERMINATED_STR: { type: "SyntaxError", number: -2146827273 },
E_DISABLED_CC: { type: "SyntaxError", number: -2146827258 },
E_ILLEGAL_ASSIGN: { type: "ReferenceError", number: -2146823280 },
......@@ -1986,6 +1987,9 @@ testSyntaxError("while(", "E_SYNTAX_ERROR");
testSyntaxError("if(", "E_SYNTAX_ERROR");
testSyntaxError("'unterminated", "E_UNTERMINATED_STR");
testSyntaxError("*", "E_SYNTAX_ERROR");
testSyntaxError("@_jscript_version", "E_DISABLED_CC");
testSyntaxError("@a", "E_DISABLED_CC");
testSyntaxError("/* @cc_on @*/ @_jscript_version", "E_DISABLED_CC");
// ReferenceError tests
testException(function() {test = function() {}}, "E_ILLEGAL_ASSIGN");
......
/*
* Copyright 2010 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
eval("@_jscript_version");
var tmp;
/*@ */
//@cc_on @*/
@_jscript_version;
@cc_on
@*/
// Standard predefined variabled
if(isWin64) {
ok(@_win64 === true, "@_win64 = " + @_win64);
ok(@_amd64 === true, "@_amd64 = " + @_amd64);
ok(isNaN(@_win32), "@_win32 = " + @_win32);
ok(isNaN(@_x86), "@_x86 = " + @_x86);
}else {
ok(@_win32 === true, "@_win32 = " + @_win32);
ok(@_x86 === true, "@_x86 = " + @_x86);
ok(isNaN(@_win64), "@_win64 = " + @_win64);
ok(isNaN(@_amd64), "@_amd64 = " + @_amd64);
}
ok(@_jscript === true, "@_jscript = " + @_jscript);
ok(@_jscript_build === ScriptEngineBuildVersion(),
"@_jscript_build = " + @_jscript_build + " expected " + ScriptEngineBuildVersion());
tmp = ScriptEngineMajorVersion() + ScriptEngineMinorVersion()/10;
ok(@_jscript_version === tmp, "@_jscript_version = " + @_jscript_version + " expected " + tmp);
ok(isNaN(@_win16), "@_win16 = " + @_win16);
ok(isNaN(@_mac), "@_mac = " + @_mac);
ok(isNaN(@_alpha), "@_alpha = " + @_alpha);
ok(isNaN(@_mc680x0), "@_mc680x0 = " + @_mc680x0);
ok(isNaN(@_PowerPC), "@_PowerPC = " + @_PowerPC);
// Undefined variable
ok(isNaN(@xxx), "@xxx = " + @xxx);
ok(isNaN(@x$_xx), "@x$_xx = " + @x$_xx);
tmp = false;
try {
eval("/*@cc_on */");
}catch(e) {
tmp = true;
}
ok(tmp, "expected syntax exception");
tmp = false;
try {
eval("/*@_jscript_version */");
}catch(e) {
tmp = true;
}
ok(tmp, "expected syntax exception");
reportSuccess();
......@@ -19,6 +19,9 @@
/* @makedep: api.js */
api.js 40 "api.js"
/* @makedep: cc.js */
cc.js 40 "cc.js"
/* @makedep: lang.js */
lang.js 40 "lang.js"
......
......@@ -87,6 +87,7 @@ DEFINE_EXPECT(invoke_func);
#define DISPID_GLOBAL_CREATEARRAY 0x100c
#define DISPID_GLOBAL_PROPGETFUNC 0x100d
#define DISPID_GLOBAL_OBJECT_FLAG 0x100e
#define DISPID_GLOBAL_ISWIN64 0x100f
#define DISPID_TESTOBJ_PROP 0x2000
......@@ -387,6 +388,12 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
return S_OK;
}
if(!strcmp_wa(bstrName, "isWin64")) {
test_grfdex(grfdex, fdexNameCaseSensitive);
*pid = DISPID_GLOBAL_ISWIN64;
return S_OK;
}
if(strict_dispid_check)
ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName));
return DISP_E_UNKNOWNNAME;
......@@ -543,6 +550,13 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
}
return S_OK;
case DISPID_GLOBAL_ISWIN64:
if(pvarRes) {
V_VT(pvarRes) = VT_BOOL;
V_BSTR(pvarRes) = sizeof(void*) == 8 ? VARIANT_TRUE : VARIANT_FALSE;
}
return S_OK;
case DISPID_GLOBAL_NULL_DISP:
ok(wFlags == INVOKE_PROPERTYGET, "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
......@@ -1420,6 +1434,7 @@ static void run_tests(void)
run_from_res("lang.js");
run_from_res("api.js");
run_from_res("regexp.js");
run_from_res("cc.js");
test_isvisible(FALSE);
test_isvisible(TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment