From dcdc6c7013906f555e8c860ab64497e7590f94c9 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 19 Oct 2010 14:00:14 +0200 Subject: [PATCH] jscript: Improved VBArray related tests. --- dlls/jscript/tests/api.js | 14 +++++++++----- dlls/jscript/tests/run.c | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 1334f7e1d0b..6d88b535eb7 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -149,8 +149,8 @@ tmp = Object.prototype.toString.call(this); ok(tmp === "[object Object]", "toString.call(this) = " + tmp); (function () { tmp = Object.prototype.toString.call(arguments); })(); ok(tmp === "[object Object]", "toString.call(arguments) = " + tmp); -(tmp = new VBArray(createArray())).f = Object.prototype.toString; -ok(tmp.f() === "[object Object]", "tmp.f() = " + tmp.f()); +tmp = Object.prototype.toString.call(new VBArray(createArray())); +ok(tmp === "[object Object]", "toString.call(new VBArray()) = " + tmp); ok(Object(1) instanceof Number, "Object(1) is not instance of Number"); ok(Object("") instanceof String, "Object('') is not instance of String"); @@ -1903,8 +1903,7 @@ exception_test(function() {new VBArray();}, "TypeError", -2146823275); exception_test(function() {new VBArray(new VBArray(createArray()));}, "TypeError", -2146823275); exception_test(function() {createArray().lbound("aaa");}, "RangeError", -2146828279); exception_test(function() {createArray().lbound(3);}, "RangeError", -2146828279); -exception_test(function() {tmp = new Object(); tmp.lb = VBArray.prototype.lbound; tmp.lb();}, "TypeError", -2146823275); -exception_test(function() {tmp = new Object(); tmp.lb = VBArray.prototype.lbound; tmp.lb();}, "TypeError", -2146823275); +exception_test(function() {VBArray.prototype.lbound.call(new Object());}, "TypeError", -2146823275); exception_test(function() {createArray().getItem(3);}, "RangeError", -2146828279); function testThisExcept(func, number) { @@ -2253,7 +2252,10 @@ ok(unescape.length == 1, "unescape.length = " + unescape.length); String.length = 3; ok(String.length == 1, "String.length = " + String.length); -var tmp = new VBArray(createArray()); +var tmp = createArray(); +ok(getVT(tmp) == "VT_ARRAY|VT_VARIANT", "getVT(createArray()) = " + getVT(tmp)); +ok(getVT(VBArray(tmp)) == "VT_ARRAY|VT_VARIANT", "getVT(VBArray(tmp)) = " + getVT(VBArray(tmp))); +tmp = new VBArray(tmp); tmp = new VBArray(VBArray(createArray())); ok(tmp.dimensions() == 2, "tmp.dimensions() = " + tmp.dimensions()); ok(tmp.lbound() == 0, "tmp.lbound() = " + tmp.lbound()); @@ -2265,5 +2267,7 @@ ok(tmp.getItem(1, 2) == 3, "tmp.getItem(1, 2) = " + tmp.getItem(1, 2)); ok(tmp.getItem(2, 3) == 33, "tmp.getItem(2, 3) = " + tmp.getItem(2, 3)); ok(tmp.getItem(3, 2) == 13, "tmp.getItem(3, 2) = " + tmp.getItem(3, 2)); ok(tmp.toArray() == "2,3,12,13,22,23,32,33,42,43", "tmp.toArray() = " + tmp.toArray()); +ok(createArray().toArray() == "2,3,12,13,22,23,32,33,42,43", + "createArray.toArray()=" + createArray().toArray()); reportSuccess(); diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 9bca96641a3..5c1a9f63638 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -487,6 +487,9 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, case VT_BOOL: V_BSTR(pvarRes) = a2bstr("VT_BOOL"); break; + case VT_ARRAY|VT_VARIANT: + V_BSTR(pvarRes) = a2bstr("VT_ARRAY|VT_VARIANT"); + break; default: ok(0, "unknown vt %d\n", V_VT(pdp->rgvarg)); return E_FAIL;