Gabriel Ivăncescu : jscript/tests: Add test for function constructor in named item context.

Alexandre Julliard julliard at winehq.org
Mon Mar 9 17:42:36 CDT 2020


Module: wine
Branch: master
Commit: b526077189c3b7295bc6140d6250371db9c0ab10
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b526077189c3b7295bc6140d6250371db9c0ab10

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Sat Mar  7 15:40:38 2020 +0200

jscript/tests: Add test for function constructor in named item context.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/tests/jscript.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/jscript/tests/jscript.c b/dlls/jscript/tests/jscript.c
index be1320fa62..5de933e935 100644
--- a/dlls/jscript/tests/jscript.c
+++ b/dlls/jscript/tests/jscript.c
@@ -1129,13 +1129,15 @@ static void test_named_items(void)
     static const WCHAR *context_idents[] =
     {
         L"testFunc",
-        L"testVar"
+        L"testVar",
+        L"testFuncConstr"
     };
     static const WCHAR *context_code_test[] =
     {
         L"testFunc();",
         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;
     IActiveScriptParse *parse;
@@ -1302,7 +1304,8 @@ static void test_named_items(void)
     SET_EXPECT(GetIDsOfNames);
     hr = IActiveScriptParse_ParseScriptText(parse, L""
         "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);
     ok(hr == S_OK, "ParseScriptText failed: %08x\n", hr);
     CHECK_CALLED(OnEnterScript);




More information about the wine-cvs mailing list