Author: cwittich
Date: Sat Aug 22 17:26:35 2009
New Revision: 42850
URL:
http://svn.reactos.org/svn/reactos?rev=42850&view=rev
Log:
sync jscript winetest with wine 1.1.28
Modified:
trunk/rostests/winetests/jscript/api.js
trunk/rostests/winetests/jscript/regexp.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?…
==============================================================================
--- trunk/rostests/winetests/jscript/api.js [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/api.js [iso-8859-1] Sat Aug 22 17:26:35 2009
@@ -76,6 +76,14 @@
ok(tmp.f() === "[object RegExp]", "tmp.f() = " + tmp.f());
(tmp = new String).f = Object.prototype.toString;
ok(tmp.f() === "[object String]", "tmp.f() = " + tmp.f());
+
+var obj = new Object();
+obj.toString = function (x) {
+ ok(arguments.length === 0, "arguments.length = " + arguments.length);
+ return "test";
+};
+ok((tmp = obj.toLocaleString()) === "test", "obj.toLocaleString() = "
+ tmp);
+ok((tmp = obj.toLocaleString(1)) === "test", "obj.toLocaleString(1) =
" + tmp);
ok("".length === 0, "\"\".length = " +
"".length);
ok(getVT("".length) == "VT_I4", "\"\".length = "
+ "".length);
@@ -1345,4 +1353,203 @@
exception_test(function() {eval("if(")}, "SyntaxError",
-2146827286);
exception_test(function() {eval("'unterminated")}, "SyntaxError",
-2146827273);
+function testObjectInherit(obj, ts, tls, vo) {
+ ok(obj.hasOwnProperty === Object.prototype.hasOwnProperty,
+ "obj.hasOwnProperty !== Object.prototype.hasOwnProprty");
+ ok(obj.isPrototypeOf === Object.prototype.isPrototypeOf,
+ "obj.isPrototypeOf !== Object.prototype.isPrototypeOf");
+ ok(obj.propertyIsEnumerable === Object.prototype.propertyIsEnumerable,
+ "obj.propertyIsEnumerable !== Object.prototype.propertyIsEnumerable");
+
+ if(ts)
+ ok(obj.toString === Object.prototype.toString,
+ "obj.toString !== Object.prototype.toString");
+ else
+ ok(obj.toString != Object.prototype.toString,
+ "obj.toString == Object.prototype.toString");
+
+ if(tls)
+ ok(obj.toLocaleString === Object.prototype.toLocaleString,
+ "obj.toLocaleString !== Object.prototype.toLocaleString");
+ else
+ ok(obj.toLocaleString != Object.prototype.toLocaleString,
+ "obj.toLocaleString == Object.prototype.toLocaleString");
+
+ if(vo)
+ ok(obj.valueOf === Object.prototype.valueOf,
+ "obj.valueOf !== Object.prototype.valueOf");
+ else
+ ok(obj.valueOf != Object.prototype.valueOf,
+ "obj.valueOf == Object.prototype.valueOf");
+
+ ok(obj._test === "test", "obj.test = " + obj._test);
+}
+
+Object.prototype._test = "test";
+testObjectInherit(new String("test"), false, true, false);
+testObjectInherit(/test/g, false, true, true);
+testObjectInherit(new Number(1), false, false, false);
+testObjectInherit(new Date(), false, false, false);
+testObjectInherit(new Boolean(true), false, true, false);
+testObjectInherit(new Array(), false, false, true);
+testObjectInherit(new Error(), false, true, true);
+testObjectInherit(testObjectInherit, false, true, true);
+testObjectInherit(Math, true, true, true);
+
+function testFunctions(obj, arr) {
+ var l;
+
+ for(var i=0; i<arr.length; i++) {
+ l = obj[arr[i][0]].length;
+ ok(l === arr[i][1], arr[i][0] + ".length = " + l);
+ }
+}
+
+testFunctions(Boolean.prototype, [
+ ["valueOf", 0],
+ ["toString", 0]
+ ]);
+
+testFunctions(Number.prototype, [
+ ["valueOf", 0],
+ ["toString", 1],
+ ["toExponential", 1],
+ ["toLocaleString", 0],
+ ["toPrecision", 1]
+ ]);
+
+testFunctions(String.prototype, [
+ ["valueOf", 0],
+ ["toString", 0],
+ ["anchor", 1],
+ ["big", 0],
+ ["blink", 0],
+ ["bold", 0],
+ ["charAt", 1],
+ ["charCodeAt", 1],
+ ["concat", 1],
+ ["fixed", 0],
+ ["fontcolor", 1],
+ ["fontsize", 1],
+ ["indexOf", 2],
+ ["italics", 0],
+ ["lastIndexOf", 2],
+ ["link", 1],
+ ["localeCompare", 1],
+ ["match", 1],
+ ["replace", 1],
+ ["search", 0],
+ ["slice", 0],
+ ["small", 0],
+ ["split", 2],
+ ["strike", 0],
+ ["sub", 0],
+ ["substr", 2],
+ ["substring", 2],
+ ["sup", 0],
+ ["toLocaleLowerCase", 0],
+ ["toLocaleUpperCase", 0],
+ ["toLowerCase", 0],
+ ["toUpperCase", 0]
+ ]);
+
+testFunctions(RegExp.prototype, [
+ ["toString", 0],
+ ["exec", 1],
+ ["test", 1]
+ ]);
+
+testFunctions(Date.prototype, [
+ ["getDate", 0],
+ ["getDay", 0],
+ ["getFullYear", 0],
+ ["getHours", 0],
+ ["getMilliseconds", 0],
+ ["getMinutes", 0],
+ ["getMonth", 0],
+ ["getSeconds", 0],
+ ["getTime", 0],
+ ["getTimezoneOffset", 0],
+ ["getUTCDate", 0],
+ ["getUTCDay", 0],
+ ["getUTCFullYear", 0],
+ ["getUTCHours", 0],
+ ["getUTCMilliseconds", 0],
+ ["getUTCMinutes", 0],
+ ["getUTCMonth", 0],
+ ["getUTCSeconds", 0],
+ ["setDate", 1],
+ ["setFullYear", 3],
+ ["setHours", 4],
+ ["setMilliseconds", 1],
+ ["setMinutes", 3],
+ ["setMonth", 2],
+ ["setSeconds", 2],
+ ["setTime", 1],
+ ["setUTCDate", 1],
+ ["setUTCFullYear", 3],
+ ["setUTCHours", 4],
+ ["setUTCMilliseconds", 1],
+ ["setUTCMinutes", 3],
+ ["setUTCMonth", 2],
+ ["setUTCSeconds", 2],
+ ["toDateString", 0],
+ ["toLocaleDateString", 0],
+ ["toLocaleString", 0],
+ ["toLocaleTimeString", 0],
+ ["toString", 0],
+ ["toTimeString", 0],
+ ["toUTCString", 0],
+ ["valueOf", 0]
+ ]);
+
+testFunctions(Array.prototype, [
+ ["concat", 1],
+ ["join", 1],
+ ["push", 1],
+ ["pop", 0],
+ ["reverse", 0],
+ ["shift", 0],
+ ["slice", 2],
+ ["sort", 1],
+ ["splice", 2],
+ ["toLocaleString", 0],
+ ["toString", 0],
+ ["unshift", 1]
+ ]);
+
+testFunctions(Error.prototype, [
+ ["toString", 0]
+ ]);
+
+testFunctions(Math, [
+ ["abs", 1],
+ ["acos", 1],
+ ["asin", 1],
+ ["atan", 1],
+ ["atan2", 2],
+ ["ceil", 1],
+ ["cos", 1],
+ ["exp", 1],
+ ["floor", 1],
+ ["log", 1],
+ ["max", 2],
+ ["min", 2],
+ ["pow", 2],
+ ["random", 0],
+ ["round", 1],
+ ["sin", 1],
+ ["sqrt", 1],
+ ["tan", 1]
+ ]);
+
+testFunctions(Object.prototype, [
+ ["hasOwnProperty", 1],
+ ["isPrototypeOf", 1],
+ ["propertyIsEnumerable", 1],
+ ["toLocaleString", 0],
+ ["toString", 0],
+ ["valueOf", 0]
+ ]);
+
reportSuccess();
Modified: trunk/rostests/winetests/jscript/regexp.js
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/regexp.…
==============================================================================
--- trunk/rostests/winetests/jscript/regexp.js [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/regexp.js [iso-8859-1] Sat Aug 22 17:26:35 2009
@@ -158,6 +158,39 @@
r = "[test1] [test2]".replace(/\[([^\[]+)\]/g, replaceFunc2);
ok(r === "r0 r1", "r = '" + r + "' expected 'r0
r1'");
+r = "$1,$2".replace(/(\$(\d))/g, "$$1-$1$2");
+ok(r === "$1-$11,$1-$22", "r = '" + r + "' expected
'$1-$11,$1-$22'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$&");
+ok(r === "abc &1 123", "r = '" + r + "' expected
'abc &1 123'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$'");
+ok(r === "abc 123 123", "r = '" + r + "' expected
'abc 123 123'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$`");
+ok(r === "abc abc 123", "r = '" + r + "' expected
'abc abc 123'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$3");
+ok(r === "abc $3 123", "r = '" + r + "' expected
'abc $3 123'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$");
+ok(r === "abc $ 123", "r = '" + r + "' expected 'abc
$ 123'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$a");
+ok(r === "abc $a 123", "r = '" + r + "' expected
'abc $a 123'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$11");
+ok(r === "abc &11 123", "r = '" + r + "' expected
'abc &11 123'");
+
+r = "abc &1 123".replace(/(\&(\d))/g, "$0");
+ok(r === "abc $0 123", "r = '" + r + "' expected
'abc $0 123'");
+
+r = "1 2 3".replace("2", "$&");
+ok(r === "1 $& 3", "r = '" + r + "' expected '1
$& 3'");
+
+r = "1 2 3".replace("2", "$'");
+ok(r === "1 $' 3", "r = '" + r + "' expected '1
$' 3'");
+
r = "1,,2,3".split(/,+/g);
ok(r.length === 3, "r.length = " + r.length);
ok(r[0] === "1", "r[0] = " + r[0]);
@@ -175,4 +208,12 @@
ok(r[0] === "1", "r[0] = " + r[0]);
ok(r[1] === "2", "r[1] = " + r[1]);
+var re;
+
+re = /abc[^d]/g;
+ok(re.source === "abc[^d]", "re.source = '" + re.source +
"', expected 'abc[^d]'");
+
+re = /a\bc[^d]/g;
+ok(re.source === "a\\bc[^d]", "re.source = '" + re.source +
"', expected 'a\\bc[^d]'");
+
reportSuccess();
Modified: trunk/rostests/winetests/jscript/run.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/jscript/run.c?r…
==============================================================================
--- trunk/rostests/winetests/jscript/run.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/jscript/run.c [iso-8859-1] Sat Aug 22 17:26:35 2009
@@ -63,6 +63,7 @@
DEFINE_EXPECT(global_propput_i);
DEFINE_EXPECT(global_success_d);
DEFINE_EXPECT(global_success_i);
+DEFINE_EXPECT(global_notexists_d);
DEFINE_EXPECT(testobj_delete);
DEFINE_EXPECT(GetItemInfo_testVal);
@@ -83,17 +84,6 @@
static BOOL strict_dispid_check;
static const char *test_name = "(null)";
-static const char *debugstr_w(LPCWSTR str)
-{
- static char buf[1024];
-
- if(!str)
- return "(null)";
-
- WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
- return buf;
-}
-
static BSTR a2bstr(const char *str)
{
BSTR ret;
@@ -168,7 +158,7 @@
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName,
DWORD grfdex)
{
- ok(0, "unexpected call %s %x\n", debugstr_w(bstrName), grfdex);
+ ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
return E_NOTIMPL;
}
@@ -219,7 +209,7 @@
{
CHECK_EXPECT(testobj_delete);
- ok(!strcmp_wa(bstrName, "deleteTest"), "unexpected name %s\n",
debugstr_w(bstrName));
+ ok(!strcmp_wa(bstrName, "deleteTest"), "unexpected name %s\n",
wine_dbgstr_w(bstrName));
ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
return S_OK;
}
@@ -288,9 +278,14 @@
*pid = DISPID_GLOBAL_NULL_BSTR;
return S_OK;
}
+ if(!strcmp_wa(bstrName, "notExists")) {
+ CHECK_EXPECT(global_notexists_d);
+ ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex);
+ return DISP_E_UNKNOWNNAME;
+ }
if(strict_dispid_check)
- ok(0, "unexpected call %s\n", debugstr_w(bstrName));
+ ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName));
return DISP_E_UNKNOWNNAME;
}
@@ -313,7 +308,7 @@
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n",
V_VT(pdp->rgvarg));
ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n",
V_VT(pdp->rgvarg));
- ok(V_BOOL(pdp->rgvarg+1), "%s: %s\n", test_name,
debugstr_w(V_BSTR(pdp->rgvarg)));
+ ok(V_BOOL(pdp->rgvarg+1), "%s: %s\n", test_name,
wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
return S_OK;
@@ -329,7 +324,7 @@
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n",
V_VT(pdp->rgvarg));
if(V_VT(pdp->rgvarg) == VT_BSTR)
- trace("%s: %s\n", test_name, debugstr_w(V_BSTR(pdp->rgvarg)));
+ trace("%s: %s\n", test_name,
wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
return S_OK;
@@ -507,7 +502,7 @@
if(!strcmp_wa(pstrName, test_valA))
CHECK_EXPECT(GetItemInfo_testVal);
else if(strcmp_wa(pstrName, testA))
- ok(0, "unexpected pstrName %s\n", debugstr_w(pstrName));
+ ok(0, "unexpected pstrName %s\n", wine_dbgstr_w(pstrName));
*ppiunkItem = (IUnknown*)&Global;
return S_OK;
@@ -835,6 +830,18 @@
parse_script_a("ok(typeof(test) === 'object', \"typeof(test) !=
'object'\");");
+ parse_script_a("function reportSuccess() {}; reportSuccess();");
+
+ SET_EXPECT(global_propget_d);
+ parse_script_a("var testPropGet");
+ CHECK_CALLED(global_propget_d);
+
+ SET_EXPECT(global_notexists_d);
+ parse_script_a("var notExists; notExists = 1;");
+ CHECK_CALLED(global_notexists_d);
+
+ parse_script_a("function f() { var testPropGet; }");
+
run_from_res("lang.js");
run_from_res("api.js");
run_from_res("regexp.js");