From b20d96576cd596a6735d9b61af4b8d6230e52828 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 5 Jun 2016 19:26:27 +0000 Subject: [PATCH] [JSCRIPT_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368 svn path=/trunk/; revision=71558 --- rostests/winetests/jscript/api.js | 6 +++ rostests/winetests/jscript/lang.js | 77 ++++++++++++++++++++++++++++ rostests/winetests/jscript/regexp.js | 17 ++++++ 3 files changed, 100 insertions(+) diff --git a/rostests/winetests/jscript/api.js b/rostests/winetests/jscript/api.js index dacacc4d764..ca6131b0424 100644 --- a/rostests/winetests/jscript/api.js +++ b/rostests/winetests/jscript/api.js @@ -2098,6 +2098,8 @@ ok(Date.parse("Jan 20 2009 UTC") === 1232409600000, "Date.parse(\"Jan 20 2009 UT ok(Date.parse("Jan 20 2009 GMT") === 1232409600000, "Date.parse(\"Jan 20 2009 GMT\") = " + Date.parse("Jan 20 2009 GMT")); ok(Date.parse("Jan 20 2009 UTC-0") === 1232409600000, "Date.parse(\"Jan 20 2009 UTC-0\") = " + Date.parse("Jan 20 2009 UTC-0")); ok(Date.parse("Jan 20 2009 UTC+0000") === 1232409600000, "Date.parse(\"Jan 20 2009 UTC+0000\") = " + Date.parse("Jan 20 2009 UTC+0000")); +ok(Date.parse("Jan 20 2009 UTC-1") === 1232413200000, "Date.parse(\"Jan 20 2009 UTC-1\") = " + Date.parse("Jan 20 2009 UTC-1")); +ok(Date.parse("Jan 20 2009 UTC+1") === 1232406000000, "Date.parse(\"Jan 20 2009 UTC+1\") = " + Date.parse("Jan 20 2009 UTC+1")); ok(Date.parse("Ju 13 79 UTC") === 300672000000, "Date.parse(\"Ju 13 79 UTC\") = " + Date.parse("Ju 13 79 UTC")); ok(Date.parse("12Au91 UTC") === 681955200000, "Date.parse(\"12Au91 UTC\") = " + Date.parse("12Au91 UTC")); ok(Date.parse("7/02/17 UTC") === -1656806400000, "Date.parse(\"7/02/17 UTC\") = " + Date.parse("7/02/17 UTC")); @@ -2108,6 +2110,10 @@ ok(Date.parse("71 11:32AM Dec 12 UTC BC ") === -64346358480000, "Date.parse(\"71 ok(Date.parse("23/71/2000 11::32::UTC") === 1010662320000, "Date.parse(\"23/71/2000 11::32::UTC\") = " + Date.parse("23/71/2000 11::32::UTC")); ok(Date.parse("1970/01/01") === Date.parse("01/01/1970"), "Date.parse(\"1970/01/01\") = " + Date.parse("1970/01/01")); ok(Date.parse("71/12/14") === Date.parse("12/14/1971"), "Date.parse(\"71/12/14\") = " + Date.parse("71/12/14")); +ok(Date.parse("Tue, 22 Mar 2016 09:57:55 -0300") === Date.parse("Tue, 22 Mar 2016 09:57:55 GMT-0300"), + "Date.parse(\"Tue, 22 Mar 2016 09:57:55 -0300\") = " + Date.parse("Tue, 22 Mar 2016 09:57:55 -0300")); +ok(Date.parse("Tue, 22 Mar 2016 09:57:55 +0400") === Date.parse("Tue, 22 Mar 2016 09:57:55 UTC+0400"), + "Date.parse(\"Tue, 22 Mar 2016 09:57:55 +0400\") = " + Date.parse("Tue, 22 Mar 2016 09:57:55 +0400")); ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI)); ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI); diff --git a/rostests/winetests/jscript/lang.js b/rostests/winetests/jscript/lang.js index 3e60aba76ad..ee3083631bb 100644 --- a/rostests/winetests/jscript/lang.js +++ b/rostests/winetests/jscript/lang.js @@ -194,6 +194,27 @@ ok(testRecFunc.arguments === null, "testRecFunc.arguments = " + testRecFunc.argu testRecFunc(true); ok(testRecFunc.arguments === null, "testRecFunc.arguments = " + testRecFunc.arguments); +function argumentsTest() { + var save = arguments; + with({arguments: 1}) { + ok(arguments === 1, "arguments = " + arguments); + (function() { + ok(argumentsTest.arguments === save, "unexpected argumentsTest.arguments"); + })(); + } + eval('ok(arguments === save, "unexpected arguments");'); + [1,2].sort(function() { + ok(argumentsTest.arguments === save, "unexpected argumentsTest.arguments"); + return 1; + }); +} + +argumentsTest(); + +(function callAsExprTest() { + ok(callAsExprTest.arguments === null, "callAsExprTest.arguments = " + callAsExprTest.arguments); +})(1,2); + tmp = (function() {1;})(); ok(tmp === undefined, "tmp = " + tmp); tmp = eval("1;"); @@ -214,6 +235,58 @@ testNoRes(), testNoRes(); tmp = (function(){ return testNoRes(), testRes();})(); +var f1, f2; + +ok(funcexpr() == 2, "funcexpr() = " + funcexpr()); + +f1 = function funcexpr() { return 1; } +ok(f1 != funcexpr, "f1 == funcexpr"); +ok(f1() === 1, "f1() = " + f1()); + +f2 = function funcexpr() { return 2; } +ok(f2 != funcexpr, "f2 != funcexpr"); +ok(f2() === 2, "f2() = " + f2()); + +f1 = null; +for(i = 0; i < 3; i++) { + f2 = function funcexpr2() {}; + ok(f1 != f2, "f1 == f2"); + f1 = f2; +} + +f1 = null; +for(i = 0; i < 3; i++) { + f2 = function() {}; + ok(f1 != f2, "f1 == f2"); + f1 = f2; +} + +(function() { + ok(infuncexpr() == 2, "infuncexpr() = " + infuncexpr()); + + f1 = function infuncexpr() { return 1; } + ok(f1 != funcexpr, "f1 == funcexpr"); + ok(f1() === 1, "f1() = " + f1()); + + f2 = function infuncexpr() { return 2; } + ok(f2 != funcexpr, "f2 != funcexpr"); + ok(f2() === 2, "f2() = " + f2()); + + f1 = null; + for(i = 0; i < 3; i++) { + f2 = function infuncexpr2() {}; + ok(f1 != f2, "f1 == f2"); + f1 = f2; + } + + f1 = null; + for(i = 0; i < 3; i++) { + f2 = function() {}; + ok(f1 != f2, "f1 == f2"); + f1 = f2; + } +})(); + var obj1 = new Object(); ok(typeof(obj1) === "object", "typeof(obj1) is not object"); ok(obj1.constructor === Object, "unexpected obj1.constructor"); @@ -389,6 +462,10 @@ tmp = 2.5*3.5; ok(tmp > 8.749999 && tmp < 8.750001, "2.5*3.5 !== 8.75"); ok(getVT(tmp) === "VT_R8", "getVT(2.5*3.5) !== VT_R8"); +tmp = 2*.5; +ok(tmp === 1, "2*.5 !== 1"); +ok(getVT(tmp) == "VT_I4", "getVT(2*.5) !== VT_I4"); + tmp = 4/2; ok(tmp === 2, "4/2 !== 2"); ok(getVT(tmp) === "VT_I4", "getVT(4/2) !== VT_I4"); diff --git a/rostests/winetests/jscript/regexp.js b/rostests/winetests/jscript/regexp.js index 25ec91e075c..b20036426eb 100644 --- a/rostests/winetests/jscript/regexp.js +++ b/rostests/winetests/jscript/regexp.js @@ -660,4 +660,21 @@ tmp = new RegExp("abc/", "mgi"); ok(tmp.toString() === "/abc//igm", "(new RegExp(\"abc/\")).toString() = " + tmp.toString()); ok(/abc/.toString(1, false, "3") === "/abc/", "/abc/.toString(1, false, \"3\") = " + /abc/.toString()); +re = /x/; +ok(re.ignoreCase === false, "re.ignoreCase = " + re.ignoreCase); +ok(re.multiline === false, "re.multiline = " + re.multiline); +ok(re.global === false, "re.global = " + re.global); +re = /x/i; +ok(re.ignoreCase === true, "re.ignoreCase = " + re.ignoreCase); +ok(re.multiline === false, "re.multiline = " + re.multiline); +ok(re.global === false, "re.global = " + re.global); +re = new RegExp("xxx", "gi"); +ok(re.ignoreCase === true, "re.ignoreCase = " + re.ignoreCase); +ok(re.multiline === false, "re.multiline = " + re.multiline); +ok(re.global === true, "re.global = " + re.global); +re = /x/mg; +ok(re.ignoreCase === false, "re.ignoreCase = " + re.ignoreCase); +ok(re.multiline === true, "re.multiline = " + re.multiline); +ok(re.global === true, "re.global = " + re.global); + reportSuccess();