[JSCRIPT_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866

svn path=/trunk/; revision=72347
This commit is contained in:
Amine Khaldi 2016-08-19 09:37:22 +00:00
parent 4dd5cd6d92
commit d4778af3f0
3 changed files with 154 additions and 4 deletions

View file

@ -350,12 +350,27 @@ ok(Object(1) instanceof Number, "Object(1) is not instance of Number");
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) {

View file

@ -101,6 +101,10 @@ function testFunc1(x, y) {
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 @@ function argumentsTest() {
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 @@ testNoRes();
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;
@ -348,6 +402,20 @@ ok(typeof(obj2) === "object", "typeof(obj2) = " + typeof(obj2));
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 @@ try {
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 @@ tmp = (function() {
})();
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

View file

@ -490,11 +490,15 @@ static HRESULT WINAPI dispexFunc_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
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 @@ static HRESULT WINAPI pureDisp_Invoke(IDispatchEx *iface, DISPID dispIdMember, R
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 @@ static BOOL run_tests(void)
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'\");");
@ -2522,6 +2537,8 @@ static BOOL run_tests(void)
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;");
CHECK_CALLED(global_notexists_d);