Author: akhaldi
Date: Fri Aug 19 09:37:22 2016
New Revision: 72347

URL: http://svn.reactos.org/svn/reactos?rev=72347&view=rev
Log:
[JSCRIPT_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866

Modified:
    trunk/rostests/winetests/jscript/api.js
    trunk/rostests/winetests/jscript/lang.js
    trunk/rostests/winetests/jscript/run.c

Modified: trunk/rostests/winetests/jscript/api.js
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/api.js?rev=72347&r1=72346&r2=72347&view=diff
==============================================================================
--- trunk/rostests/winetests/jscript/api.js     [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/api.js     [iso-8859-1] Fri Aug 19 
09:37:22 2016
@@ -350,12 +350,27 @@
 ok(Object("") instanceof String, "Object('') is not instance of String");
 ok(Object(false) instanceof Boolean, "Object(false) is not instance of 
Boolean");
 
+ok(new Object(1) instanceof Number, "Object(1) is not instance of Number");
+ok(new Object("") instanceof String, "Object('') is not instance of String");
+ok(new Object(false) instanceof Boolean, "Object(false) is not instance of 
Boolean");
+
 obj = new Object();
 ok(Object(obj) === obj, "Object(obj) !== obj");
 
 ok(typeof(Object()) === "object", "typeof(Object()) !== 'object'");
 ok(typeof(Object(undefined)) === "object", "typeof(Object(undefined)) !== 
'object'");
 ok(typeof(Object(null)) === "object", "typeof(Object(null)) !== 'object'");
+ok(typeof(Object(nullDisp)) === "object", "typeof(Object(nullDisp)) !== 
'object'");
+
+ok(Object(nullDisp) != nullDisp, "Object(nullDisp) == nullDisp");
+ok(new Object(nullDisp) != nullDisp, "new Object(nullDisp) == nullDisp");
+
+ok(Object(testObj) === testObj, "Object(testObj) != testObj\n");
+ok(new Object(testObj) === testObj, "new Object(testObj) != testObj\n");
+
+tmp = new Object();
+ok(Object(tmp) === tmp, "Object(tmp) != tmp");
+ok(new Object(tmp) === tmp, "new Object(tmp) != tmp");
 
 var obj = new Object();
 obj.toString = function (x) {

Modified: trunk/rostests/winetests/jscript/lang.js
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/lang.js?rev=72347&r1=72346&r2=72347&view=diff
==============================================================================
--- trunk/rostests/winetests/jscript/lang.js    [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/lang.js    [iso-8859-1] Fri Aug 19 
09:37:22 2016
@@ -100,6 +100,10 @@
     tmp = delete arguments;
     ok(tmp === false, "arguments deleted");
     ok(typeof(arguments) === "object", "typeof(arguments) = " + 
typeof(arguments));
+
+    x = 2;
+    ok(x === 2, "x = " + x);
+    ok(arguments[0] === 2, "arguments[0] = " + arguments[0]);
 
     return true;
 }
@@ -211,6 +215,38 @@
 
 argumentsTest();
 
+// arguments object detached from its execution context
+(function() {
+    var args, get_x, set_x;
+
+    function test_args(detached) {
+        ok(args[0] === 1, "args[0] = " + args[0]);
+        set_x(2);
+        ok(args[0] === (detached ? 1 : 2), "args[0] = " + args[0] + " expected 
" + (detached ? 1 : 2));
+        args[0] = 3;
+        ok(get_x() === (detached ? 2 : 3), "get_x() = " + get_x());
+        ok(args[0] === 3, "args[0] = " + args[0]);
+    }
+
+    (function(x) {
+        args = arguments;
+        get_x = function() { return x; };
+        set_x = function(v) { x = v; };
+
+        test_args(false);
+        x = 1;
+    })(1);
+
+    test_args(true);
+})();
+
+// arguments is a regular variable, it may be overwritten
+(function() {
+    ok(typeof(arguments) === "object", "typeof(arguments) = " + 
typeof(arguments));
+    arguments = 1;
+    ok(arguments === 1, "arguments = " + arguments);
+})();
+
 (function callAsExprTest() {
     ok(callAsExprTest.arguments === null, "callAsExprTest.arguments = " + 
callAsExprTest.arguments);
 })(1,2);
@@ -233,6 +269,24 @@
 testRes() && testRes();
 testNoRes(), testNoRes();
 
+(function() {
+    eval("var x=1;");
+    ok(x === 1, "x = " + x);
+})();
+
+(function() {
+    var e = eval;
+    var r = e(1);
+    ok(r === 1, "r = " + r);
+    (function(x, a) { x(a); })(eval, "2");
+})();
+
+(function(r) {
+    r = eval("1");
+    ok(r === 1, "r = " + r);
+    (function(x, a) { x(a); })(eval, "2");
+})();
+
 tmp = (function(){ return testNoRes(), testRes();})();
 
 var f1, f2;
@@ -347,6 +401,20 @@
 
 var obj3 = new Object;
 ok(typeof(obj3) === "object", "typeof(obj3) is not object");
+
+(function() {
+    ok(typeof(func) === "function", "typeof(func) = " + typeof(func));
+    function func() {}
+    ok(typeof(func) === "function", "typeof(func) = " + typeof(func));
+    func = 0;
+    ok(typeof(func) === "number", "typeof(func) = " + typeof(func));
+})();
+
+(function(f) {
+    ok(typeof(f) === "function", "typeof(f) = " + typeof(f));
+    function f() {};
+    ok(typeof(f) === "function", "typeof(f) = " + typeof(f));
+})(1);
 
 for(var iter in "test")
     ok(false, "unexpected forin call, test = " + iter);
@@ -1250,6 +1318,38 @@
     ok(false, "deleteTest not throwed exception?");
 }catch(ex) {}
 
+(function() {
+    var to_delete = 2;
+    var r = delete to_delete;
+    ok(r === false, "delete 1 returned " + r);
+    if(r)
+        return;
+    ok(to_delete === 2, "to_delete = " + to_delete);
+
+    to_delete = new Object();
+    r = delete to_delete;
+    ok(r === false, "delete 2 returned " + r);
+    ok(typeof(to_delete) === "object", "typeof(to_delete) = " + 
typeof(to_delete));
+})();
+
+(function(to_delete) {
+    var r = delete to_delete;
+    ok(r === false, "delete 3 returned " + r);
+    ok(to_delete === 2, "to_delete = " + to_delete);
+
+    to_delete = new Object();
+    r = delete to_delete;
+    ok(r === false, "delete 4 returned " + r);
+    ok(typeof(to_delete) === "object", "typeof(to_delete) = " + 
typeof(to_delete));
+})(2);
+
+(function() {
+    with({to_delete: new Object()}) {
+        var r = delete to_delete;
+        ok(r === true, "delete returned " + r);
+    }
+})();
+
 if (false)
     if (true)
         ok(false, "if evaluated");
@@ -1497,6 +1597,24 @@
 })();
 ok(tmp, "tmp = " + tmp);
 
+(function() {
+    ok(typeof(func) === "function", "typeof(func)  = " + typeof(func));
+    with(new Object()) {
+        var x = false && function func() {};
+    }
+    ok(typeof(func) === "function", "typeof(func)  = " + typeof(func));
+})();
+
+(function() {
+    ok(x === undefined, "x = " + x); // x is declared, but never initialized
+    with({x: 1}) {
+        ok(x === 1, "x = " + x);
+        var x = 2;
+        ok(x === 2, "x = " + x);
+    }
+    ok(x === undefined, "x = " + x);
+})();
+
 /* NoNewline rule parser tests */
 while(true) {
     if(true) break

Modified: trunk/rostests/winetests/jscript/run.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/run.c?rev=72347&r1=72346&r2=72347&view=diff
==============================================================================
--- trunk/rostests/winetests/jscript/run.c      [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/run.c      [iso-8859-1] Fri Aug 19 
09:37:22 2016
@@ -490,11 +490,15 @@
         ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
         ok(pdp->cNamedArgs == 1, "cNamedArgs = %d\n", pdp->cNamedArgs);
         ok(res != NULL, "res == NULL\n");
-        ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", 
wFlags);
         ok(pei != NULL, "pei == NULL\n");
 
         ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(pdp->rgvarg+1) = %d\n", 
V_VT(pdp->rgvarg+1));
-        ok(!V_BOOL(pdp->rgvarg+1), "V_BOOL(pdp->rgvarg+1) = %x\n", 
V_BOOL(pdp->rgvarg+1));
+
+        if(V_BOOL(pdp->rgvarg+1))
+            /* NOTE: If called by Function.apply(), native doesn't set 
DISPATCH_PROPERTYGET flag. */
+            todo_wine ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
+        else
+            ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = 
%x\n", wFlags);
 
         ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", 
V_VT(pdp->rgvarg));
         ok(V_DISPATCH(pdp->rgvarg) != NULL, "V_DISPATCH(pdp->rgvarg) == 
NULL\n");
@@ -574,12 +578,15 @@
         ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
         ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
         ok(res != NULL, "res == NULL\n");
-        ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = %x\n", 
wFlags);
         ok(ei != NULL, "ei == NULL\n");
         ok(puArgErr != NULL, "puArgErr == NULL\n");
 
         ok(V_VT(pdp->rgvarg) == VT_BOOL, "V_VT(pdp->rgvarg) = %d\n", 
V_VT(pdp->rgvarg));
-        ok(!V_BOOL(pdp->rgvarg), "V_BOOL(pdp->rgvarg) = %x\n", 
V_BOOL(pdp->rgvarg));
+
+        if(V_BOOL(pdp->rgvarg))
+            todo_wine ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
+        else
+            ok(wFlags == (DISPATCH_PROPERTYGET|DISPATCH_METHOD), "wFlags = 
%x\n", wFlags);
 
         if(res)
             V_VT(res) = VT_NULL;
@@ -2508,6 +2515,14 @@
     parse_script_a("var t = {func: dispexFunc}; t = t.func(false);");
     CHECK_CALLED(dispexfunc_value);
 
+    SET_EXPECT(dispexfunc_value);
+    parse_script_a("Function.prototype.apply.call(dispexFunc, testObj, 
[true]);");
+    CHECK_CALLED(dispexfunc_value);
+
+    SET_EXPECT(puredisp_value);
+    parse_script_a("Function.prototype.apply.call(pureDisp, testObj, 
[true]);");
+    CHECK_CALLED(puredisp_value);
+
     parse_script_a("(function reportSuccess() {})()");
 
     parse_script_a("ok(typeof(test) === 'object', \"typeof(test) != 
'object'\");");
@@ -2521,6 +2536,8 @@
     SET_EXPECT(global_propget_d);
     parse_script_a("eval('var testPropGet;');");
     CHECK_CALLED(global_propget_d);
+
+    parse_script_a("var testPropGet; function testPropGet() {}");
 
     SET_EXPECT(global_notexists_d);
     parse_script_a("var notExists; notExists = 1;");


Reply via email to