From 39e79c76c9e6551f60dab5a35e2d865f8b90294f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 1 Nov 2019 17:55:23 +0100 Subject: [PATCH] vbscript/tests: Add redim statement tests. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/vbscript/tests/lang.vbs | 31 ++++++++++++++++++++++++++++++- dlls/vbscript/tests/run.c | 2 ++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 8a6fa7834b5..5d8e02a7aba 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -18,7 +18,7 @@ OPTION EXPLICIT : : DIM W -dim x, y, z +dim x, y, z, e Dim obj call ok(true, "true is not true?") @@ -1316,11 +1316,38 @@ end sub x = Array(1) changearg x(0) ok x(0) = 2, "x(0) = " & x(0) +ok getVT(x) = "VT_ARRAY|VT_VARIANT*", "getVT(x) after redim = " & getVT(x) x = Array(1) changearg (x(0)) ok x(0) = 1, "x(0) = " & x(0) +x = Array(1) +redim x(4) +ok ubound(x) = 4, "ubound(x) = " & ubound(x) +ok x(0) = empty, "x(0) = " & x(0) + +x = 1 +redim x(3) +ok ubound(x) = 3, "ubound(x) = " & ubound(x) + +x = Array(1, 2) +redim x(-1) +ok lbound(x) = 0, "lbound(x) = " & lbound(x) +ok ubound(x) = -1, "ubound(x) = " & ubound(x) + +redim x(3, 2) +ok ubound(x) = 3, "ubound(x) = " & ubound(x) +ok ubound(x, 1) = 3, "ubound(x, 1) = " & ubound(x, 1) +ok ubound(x, 2) = 2, "ubound(x, 2) = " & ubound(x, 2) & " expected 2" + +dim staticarray(4) +on error resume next +redim staticarray(3) +e = err.number +on error goto 0 +todo_wine_ok e = 10, "e = " & e + Class ArrClass Dim classarr(3) Dim classnoarr() @@ -1523,6 +1550,8 @@ sub test_dotIdentifiers Call ok(testObj.resume = 10, "testObj.resume = " & testObj.resume & " expected 10") Call ok(testObj.goto = 10, "testObj.goto = " & testObj.goto & " expected 10") Call ok(testObj.with = 10, "testObj.with = " & testObj.with & " expected 10") + Call ok(testObj.redim = 10, "testObj.redim = " & testObj.redim & " expected 10") + Call ok(testObj.preserve = 10, "testObj.preserve = " & testObj.preserve & " expected 10") end sub call test_dotIdentifiers diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 527055f83b4..208d647d46e 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -856,6 +856,8 @@ static HRESULT WINAPI testObj_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD { L"on", DISPID_TESTOBJ_KEYWORD }, { L"resume", DISPID_TESTOBJ_KEYWORD }, { L"goto", DISPID_TESTOBJ_KEYWORD }, + { L"redim", DISPID_TESTOBJ_KEYWORD }, + { L"preserve", DISPID_TESTOBJ_KEYWORD }, { L"with", DISPID_TESTOBJ_KEYWORD } }; -- 2.11.4.GIT