jscript/tests: Add test for function constructor in named item context.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
335e0073c5
commit
b526077189
|
@ -1129,13 +1129,15 @@ static void test_named_items(void)
|
||||||
static const WCHAR *context_idents[] =
|
static const WCHAR *context_idents[] =
|
||||||
{
|
{
|
||||||
L"testFunc",
|
L"testFunc",
|
||||||
L"testVar"
|
L"testVar",
|
||||||
|
L"testFuncConstr"
|
||||||
};
|
};
|
||||||
static const WCHAR *context_code_test[] =
|
static const WCHAR *context_code_test[] =
|
||||||
{
|
{
|
||||||
L"testFunc();",
|
L"testFunc();",
|
||||||
L"if(testVar != 42) throw new Error();",
|
L"if(testVar != 42) throw new Error();",
|
||||||
L"if(Math.abs(-testVar) != 42) throw new Error();"
|
L"if(Math.abs(-testVar) != 42) throw new Error();",
|
||||||
|
L"if(testFuncConstr() != testVar) throw new Error();"
|
||||||
};
|
};
|
||||||
IDispatchEx *dispex, *dispex2;
|
IDispatchEx *dispex, *dispex2;
|
||||||
IActiveScriptParse *parse;
|
IActiveScriptParse *parse;
|
||||||
|
@ -1302,7 +1304,8 @@ static void test_named_items(void)
|
||||||
SET_EXPECT(GetIDsOfNames);
|
SET_EXPECT(GetIDsOfNames);
|
||||||
hr = IActiveScriptParse_ParseScriptText(parse, L""
|
hr = IActiveScriptParse_ParseScriptText(parse, L""
|
||||||
"var testVar = 42;\n"
|
"var testVar = 42;\n"
|
||||||
"testVar_global = 5;\n",
|
"testVar_global = 5;\n"
|
||||||
|
"var testFuncConstr = new Function(\"return testVar;\");\n",
|
||||||
L"codeOnlyItem", NULL, NULL, 0, 0, SCRIPTTEXT_ISPERSISTENT, NULL, NULL);
|
L"codeOnlyItem", NULL, NULL, 0, 0, SCRIPTTEXT_ISPERSISTENT, NULL, NULL);
|
||||||
ok(hr == S_OK, "ParseScriptText failed: %08x\n", hr);
|
ok(hr == S_OK, "ParseScriptText failed: %08x\n", hr);
|
||||||
CHECK_CALLED(OnEnterScript);
|
CHECK_CALLED(OnEnterScript);
|
||||||
|
|
Loading…
Reference in New Issue