Author: akhaldi
Date: Wed Apr 23 18:06:48 2014
New Revision: 62932
URL:
http://svn.reactos.org/svn/reactos?rev=62932&view=rev
Log:
[VBSCRIPT_WINETEST]
* Sync with Wine 1.7.17.
CORE-8080
Added:
trunk/rostests/winetests/vbscript/error.vbs (with props)
Modified:
trunk/rostests/winetests/vbscript/CMakeLists.txt
trunk/rostests/winetests/vbscript/createobj.c
trunk/rostests/winetests/vbscript/lang.vbs
trunk/rostests/winetests/vbscript/regexp.vbs
trunk/rostests/winetests/vbscript/rsrc.rc
trunk/rostests/winetests/vbscript/run.c
Modified: trunk/rostests/winetests/vbscript/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/vbscript/CMakeL…
==============================================================================
--- trunk/rostests/winetests/vbscript/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/vbscript/CMakeLists.txt [iso-8859-1] Wed Apr 23 18:06:48
2014
@@ -10,6 +10,7 @@
list(APPEND vbscript_winetest_rc_deps
${CMAKE_CURRENT_SOURCE_DIR}/api.vbs
+ ${CMAKE_CURRENT_SOURCE_DIR}/error.vbs
${CMAKE_CURRENT_SOURCE_DIR}/lang.vbs
${CMAKE_CURRENT_SOURCE_DIR}/regexp.vbs)
Modified: trunk/rostests/winetests/vbscript/createobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/vbscript/create…
==============================================================================
--- trunk/rostests/winetests/vbscript/createobj.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/vbscript/createobj.c [iso-8859-1] Wed Apr 23 18:06:48 2014
@@ -125,18 +125,6 @@
#define VB_E_CANNOT_CREATE_OBJ 0x800a01ad
-static const char *debugstr_guid(REFIID riid)
-{
- static char buf[50];
-
- sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
- riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
- riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
- riid->Data4[5], riid->Data4[6], riid->Data4[7]);
-
- return buf;
-}
-
static BSTR a2bstr(const char *str)
{
BSTR ret;
@@ -444,7 +432,7 @@
CHECK_EXPECT(CreateInstance);
ok(!outer, "outer = %p\n", outer);
- ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n",
debugstr_guid(riid));
+ ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n",
wine_dbgstr_guid(riid));
if(SUCCEEDED(CreateInstance_hres))
*ppv = &testObj;
@@ -500,7 +488,7 @@
ok(cbPolicy == sizeof(DWORD), "cbPolicy = %d\n", cbPolicy);
ok(pContext != NULL, "pContext == NULL\n");
ok(cbContext == sizeof(GUID), "cbContext = %d\n", cbContext);
- ok(IsEqualGUID(pContext, &CLSID_TestObj), "pContext = %s\n",
debugstr_guid((const IID*)pContext));
+ ok(IsEqualGUID(pContext, &CLSID_TestObj), "pContext = %s\n",
wine_dbgstr_guid((const IID*)pContext));
ok(!dwFlags, "dwFlags = %x\n", dwFlags);
ok(!dwReserved, "dwReserved = %x\n", dwReserved);
@@ -517,7 +505,7 @@
CHECK_EXPECT(QueryCustomPolicy);
- ok(IsEqualGUID(&GUID_CUSTOM_CONFIRMOBJECTSAFETY, guidKey), "guidKey =
%s\n", debugstr_guid(guidKey));
+ ok(IsEqualGUID(&GUID_CUSTOM_CONFIRMOBJECTSAFETY, guidKey), "guidKey =
%s\n", wine_dbgstr_guid(guidKey));
ok(ppPolicy != NULL, "ppPolicy == NULL\n");
ok(pcbPolicy != NULL, "pcbPolicy == NULL\n");
@@ -582,13 +570,13 @@
CHECK_EXPECT(Host_QS_SecMgr);
else
CHECK_EXPECT(Caller_QS_SecMgr);
- ok(IsEqualGUID(&IID_IInternetHostSecurityManager, riid), "unexpected
riid %s\n", debugstr_guid(riid));
+ ok(IsEqualGUID(&IID_IInternetHostSecurityManager, riid), "unexpected
riid %s\n", wine_dbgstr_guid(riid));
if(SUCCEEDED(QS_SecMgr_hres))
*ppv = &InternetHostSecurityManager;
return QS_SecMgr_hres;
}
- ok(0, "unexpected service %s\n", debugstr_guid(guidService));
+ ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
return E_NOINTERFACE;
}
@@ -1008,7 +996,7 @@
SET_EXPECT(SetSite);
SET_EXPECT(reportSuccess);
hres = parse_script_ae(parser, "Call GetObject(\"clsid:"
TESTOBJINST_CLSID "\").reportSuccess()");
- if(hres == 0x8007007e) { /* Workaround for broken win2k */
+ if(hres == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) { /* Workaround for broken win2k
*/
win_skip("got unexpected error %08x\n", hres);
CLEAR_CALLED(QI_IObjectWithSite);
CLEAR_CALLED(SetSite);
@@ -1016,6 +1004,7 @@
IActiveScriptParse_Release(parser);
return;
}
+ ok(hres == S_OK, "hres = %08x\n", hres);
CHECK_CALLED(QI_IObjectWithSite);
CHECK_CALLED(SetSite);
CHECK_CALLED(reportSuccess);
@@ -1050,7 +1039,7 @@
DWORD res;
if(!init) {
- RegDeleteKey(HKEY_CLASSES_ROOT, key_name);
+ RegDeleteKeyA(HKEY_CLASSES_ROOT, key_name);
return TRUE;
}
@@ -1111,12 +1100,13 @@
CoInitialize(NULL);
if(check_vbscript()) {
- register_activex();
-
- test_CreateObject();
- test_GetObject();
-
- init_registry(FALSE);
+ if(register_activex()) {
+ test_CreateObject();
+ test_GetObject();
+ init_registry(FALSE);
+ }else {
+ skip("Could not register ActiveX object.\n");
+ }
}else {
win_skip("Broken engine, probably too old\n");
}
Added: trunk/rostests/winetests/vbscript/error.vbs
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/vbscript/error.…
==============================================================================
--- trunk/rostests/winetests/vbscript/error.vbs (added)
+++ trunk/rostests/winetests/vbscript/error.vbs [iso-8859-1] Wed Apr 23 18:06:48 2014
@@ -0,0 +1,374 @@
+'
+' Copyright 2014 Jacek Caban for CodeWeavers
+'
+' This library is free software; you can redistribute it and/or
+' modify it under the terms of the GNU Lesser General Public
+' License as published by the Free Software Foundation; either
+' version 2.1 of the License, or (at your option) any later version.
+'
+' This library is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+' Lesser General Public License for more details.
+'
+' You should have received a copy of the GNU Lesser General Public
+' License along with this library; if not, write to the Free Software
+' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+'
+
+Option Explicit
+
+const E_TESTERROR = &h80080008&
+
+const VB_E_FORLOOPNOTINITIALIZED = 92
+const VB_E_OBJNOTCOLLECTION = 451
+
+const E_NOTIMPL = &h80004001&
+const E_NOINTERFACE = &h80004002&
+const DISP_E_UNKNOWNINTERFACE = &h80020001&
+const DISP_E_MEMBERNOTFOUND = &h80020003&
+const DISP_E_PARAMNOTFOUND = &h80020004&
+const DISP_E_TYPEMISMATCH = &h80020005&
+const DISP_E_UNKNOWNNAME = &h80020006&
+const DISP_E_NONAMEDARGS = &h80020007&
+const DISP_E_BADVARTYPE = &h80020008&
+const DISP_E_OVERFLOW = &h8002000A&
+const DISP_E_BADINDEX = &h8002000B&
+const DISP_E_UNKNOWNLCID = &h8002000C&
+const DISP_E_ARRAYISLOCKED = &h8002000D&
+const DISP_E_BADPARAMCOUNT = &h8002000E&
+const DISP_E_PARAMNOTOPTIONAL = &h8002000F&
+const DISP_E_NOTACOLLECTION = &h80020011&
+const TYPE_E_DLLFUNCTIONNOTFOUND = &h8002802F&
+const TYPE_E_TYPEMISMATCH = &h80028CA0&
+const TYPE_E_OUTOFBOUNDS = &h80028CA1&
+const TYPE_E_IOERROR = &h80028CA2&
+const TYPE_E_CANTCREATETMPFILE = &h80028CA3&
+const STG_E_FILENOTFOUND = &h80030002&
+const STG_E_PATHNOTFOUND = &h80030003&
+const STG_E_TOOMANYOPENFILES = &h80030004&
+const STG_E_ACCESSDENIED = &h80030005&
+const STG_E_INSUFFICIENTMEMORY = &h80030008&
+const STG_E_NOMOREFILES = &h80030012&
+const STG_E_DISKISWRITEPROTECTED = &h80030013&
+const STG_E_WRITEFAULT = &h8003001D&
+const STG_E_READFAULT = &h8003001E&
+const STG_E_SHAREVIOLATION = &h80030020&
+const STG_E_LOCKVIOLATION = &h80030021&
+const STG_E_FILEALREADYEXISTS = &h80030050&
+const STG_E_MEDIUMFULL = &h80030070&
+const STG_E_INVALIDNAME = &h800300FC&
+const STG_E_INUSE = &h80030100&
+const STG_E_NOTCURRENT = &h80030101&
+const STG_E_CANTSAVE = &h80030103&
+const REGDB_E_CLASSNOTREG = &h80040154&
+const MK_E_UNAVAILABLE = &h800401E3&
+const MK_E_INVALIDEXTENSION = &h800401E6&
+const MK_E_CANTOPENFILE = &h800401EA&
+const CO_E_CLASSSTRING = &h800401F3&
+const CO_E_APPNOTFOUND = &h800401F5&
+const O_E_APPDIDNTREG = &h800401FE&
+const E_ACCESSDENIED = &h80070005&
+const E_OUTOFMEMORY = &h8007000E&
+const E_INVALIDARG = &h80070057&
+const RPC_S_SERVER_UNAVAILABLE = &h800706BA&
+const CO_E_SERVER_EXEC_FAILURE = &h80080005&
+
+call ok(Err.Number = 0, "Err.Number = " & Err.Number)
+
+dim calledFunc
+
+sub returnTrue
+ calledFunc = true
+ returnTrue = true
+end sub
+
+sub testThrow
+ on error resume next
+
+ dim x, y
+
+ call throwInt(1000)
+ call ok(Err.Number = 0, "Err.Number = " & Err.Number)
+
+ call throwInt(E_TESTERROR)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ call throwInt(1000)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ call Err.clear()
+ call ok(Err.Number = 0, "Err.Number = " & Err.Number)
+
+ x = 6
+ calledFunc = false
+ x = throwInt(E_TESTERROR) and returnTrue()
+ call ok(x = 6, "x = " & x)
+ call ok(not calledFunc, "calledFunc = " & calledFunc)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ x = false
+ call Err.clear()
+ if false and throwInt(E_TESTERROR) then
+ x = true
+ else
+ call ok(false, "unexpected if else branch on throw")
+ end if
+ call ok(x, "if branch not taken")
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ x = false
+ call Err.clear()
+ if throwInt(E_TESTERROR) then x = true
+ call ok(x, "if branch not taken")
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ x = false
+ call Err.clear()
+ if false then
+ call ok(false, "unexpected if else branch on throw")
+ elseif throwInt(E_TESTERROR) then
+ x = true
+ else
+ call ok(false, "unexpected if else branch on throw")
+ end if
+ call ok(x, "elseif branch not taken")
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ call Err.clear()
+ if true then
+ call throwInt(E_TESTERROR)
+ else
+ call ok(false, "unexpected if else branch on throw")
+ end if
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ x = false
+ call Err.clear()
+ do while throwInt(E_TESTERROR)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+ x = true
+ exit do
+ loop
+ call ok(x, "if branch not taken")
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ x = 0
+ call Err.clear()
+ do
+ x = x+1
+ call ok(Err.Number = 0, "Err.Number = " & Err.Number)
+ loop while throwInt(E_TESTERROR)
+ call ok(x = 1, "if branch not taken")
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ x = 0
+ call Err.clear()
+ do
+ x = x+1
+ call ok(Err.Number = 0, "Err.Number = " & Err.Number)
+ loop until throwInt(E_TESTERROR)
+ call ok(x = 1, "if branch not taken")
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ call Err.clear()
+ x = 0
+ while x < 2
+ x = x+1
+ call throwInt(E_TESTERROR)
+ wend
+ call ok(x = 2, "x = " & x)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ call Err.clear()
+ x = 2
+ y = 0
+ for each x in throwInt(E_TESTERROR)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+ y = y+1
+ next
+ call ok(x = 2, "x = " & x)
+ call ok(y = 1, "y = " & y)
+ 'todo_wine call ok(Err.Number = VB_E_OBJNOTCOLLECTION, "Err.Number = "
& Err.Number)
+
+ Err.clear()
+ y = 0
+ x = 6
+ for x = throwInt(E_TESTERROR) to 100
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+ call ok(x = 6, "x = " & x)
+ y = y+1
+ next
+ call ok(y = 1, "y = " & y)
+ call ok(x = 6, "x = " & x)
+ 'todo_wine call ok(Err.Number = VB_E_FORLOOPNOTINITIALIZED, "Err.Number =
" & Err.Number)
+
+ Err.clear()
+ y = 0
+ x = 6
+ for x = 100 to throwInt(E_TESTERROR)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+ 'todo_wine call ok(x = 6, "x = " & x)
+ y = y+1
+ next
+ call ok(y = 1, "y = " & y)
+ 'todo_wine call ok(x = 6, "x = " & x)
+ 'todo_wine call ok(Err.Number = VB_E_FORLOOPNOTINITIALIZED, "Err.Number =
" & Err.Number)
+
+ select case throwInt(E_TESTERROR)
+ case true
+ call ok(false, "unexpected case true")
+ case false
+ call ok(false, "unexpected case false")
+ case empty
+ call ok(false, "unexpected case empty")
+ case else
+ call ok(false, "unexpected case else")
+ end select
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ x = false
+ select case false
+ case true
+ call ok(false, "unexpected case true")
+ case throwInt(E_TESTERROR)
+ x = true
+ case else
+ call ok(false, "unexpected case else")
+ end select
+ call ok(x, "case not executed")
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+
+ 'Exception in non-trivial stack context
+ for x = 1 to 1
+ for each y in collectionObj
+ select case 3
+ case 1
+ call ok(false, "unexpected case")
+ case throwInt(E_TESTERROR)
+ exit for
+ case 2
+ call ok(false, "unexpected case")
+ end select
+ next
+ next
+end sub
+
+call testThrow
+
+dim x
+
+sub testOnError(resumeNext)
+ if resumeNext then
+ on error resume next
+ else
+ on error goto 0
+ end if
+ x = 1
+ throwInt(E_TESTERROR)
+ x = 2
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+end sub
+
+sub callTestOnError(resumeNext)
+ on error resume next
+ call testOnError(resumeNext)
+ call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number)
+end sub
+
+x = 0
+call callTestOnError(true)
+call ok(x = 2, "x = " & x)
+
+x = 0
+call callTestOnError(false)
+call ok(x = 1, "x = " & x)
+
+sub testForEachError()
+ on error resume next
+
+ dim x, y
+ y = false
+ for each x in empty
+ y = true
+ next
+ call ok(y, "for each not executed")
+ 'todo_wine call ok(Err.Number = VB_E_OBJNOTCOLLECTION, "Err.Number = "
& Err.Number)
+end sub
+
+call testForEachError()
+
+sub testHresMap(hres, code)
+ on error resume next
+
+ call Err.Clear()
+ call throwInt(hres)
+ call ok(Err.Number = code, "throw(" & hex(hres) & ")
Err.Number = " & Err.Number)
+end sub
+
+testHresMap E_NOTIMPL, 445
+testHresMap E_NOINTERFACE, 430
+testHresMap DISP_E_UNKNOWNINTERFACE, 438
+testHresMap DISP_E_MEMBERNOTFOUND, 438
+testHresMap DISP_E_PARAMNOTFOUND, 448
+testHresMap DISP_E_TYPEMISMATCH, 13
+testHresMap DISP_E_UNKNOWNNAME, 438
+testHresMap DISP_E_NONAMEDARGS, 446
+testHresMap DISP_E_BADVARTYPE, 458
+testHresMap DISP_E_OVERFLOW, 6
+testHresMap DISP_E_BADINDEX, 9
+testHresMap DISP_E_UNKNOWNLCID, 447
+testHresMap DISP_E_ARRAYISLOCKED, 10
+testHresMap DISP_E_BADPARAMCOUNT, 450
+testHresMap DISP_E_PARAMNOTOPTIONAL, 449
+testHresMap DISP_E_NOTACOLLECTION, 451
+testHresMap TYPE_E_DLLFUNCTIONNOTFOUND, 453
+testHresMap TYPE_E_TYPEMISMATCH, 13
+testHresMap TYPE_E_OUTOFBOUNDS, 9
+testHresMap TYPE_E_IOERROR, 57
+testHresMap TYPE_E_CANTCREATETMPFILE, 322
+testHresMap STG_E_FILENOTFOUND, 432
+testHresMap STG_E_PATHNOTFOUND, 76
+testHresMap STG_E_TOOMANYOPENFILES, 67
+testHresMap STG_E_ACCESSDENIED, 70
+testHresMap STG_E_INSUFFICIENTMEMORY, 7
+testHresMap STG_E_NOMOREFILES, 67
+testHresMap STG_E_DISKISWRITEPROTECTED, 70
+testHresMap STG_E_WRITEFAULT, 57
+testHresMap STG_E_READFAULT, 57
+testHresMap STG_E_SHAREVIOLATION, 75
+testHresMap STG_E_LOCKVIOLATION, 70
+testHresMap STG_E_FILEALREADYEXISTS, 58
+testHresMap STG_E_MEDIUMFULL, 61
+testHresMap STG_E_INVALIDNAME, 53
+testHresMap STG_E_INUSE, 70
+testHresMap STG_E_NOTCURRENT, 70
+testHresMap STG_E_CANTSAVE, 57
+testHresMap REGDB_E_CLASSNOTREG, 429
+testHresMap MK_E_UNAVAILABLE, 429
+testHresMap MK_E_INVALIDEXTENSION, 432
+testHresMap MK_E_CANTOPENFILE, 432
+testHresMap CO_E_CLASSSTRING, 429
+testHresMap CO_E_APPNOTFOUND, 429
+testHresMap O_E_APPDIDNTREG, 429
+testHresMap E_ACCESSDENIED, 70
+testHresMap E_OUTOFMEMORY, 7
+testHresMap E_INVALIDARG, 5
+testHresMap RPC_S_SERVER_UNAVAILABLE, 462
+testHresMap CO_E_SERVER_EXEC_FAILURE, 429
+
+sub testVBErrorCodes()
+ on error resume next
+
+ Err.clear()
+ throwInt(&h800a00aa&)
+ call ok(Err.number = 170, "Err.number = " & Err.number)
+
+ Err.clear()
+ throwInt(&h800a10aa&)
+ call ok(Err.number = 4266, "Err.number = " & Err.number)
+end sub
+
+call testVBErrorCodes
+
+call reportSuccess()
Propchange: trunk/rostests/winetests/vbscript/error.vbs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/winetests/vbscript/lang.vbs
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/vbscript/lang.v…
==============================================================================
--- trunk/rostests/winetests/vbscript/lang.vbs [iso-8859-1] (original)
+++ trunk/rostests/winetests/vbscript/lang.vbs [iso-8859-1] Wed Apr 23 18:06:48 2014
@@ -19,6 +19,7 @@
Option Explicit
dim x, y, z
+Dim obj
call ok(true, "true is not true?")
ok true, "true is not true?"
@@ -224,6 +225,10 @@
if false then x=1 else x=2 end if
+x = false
+if false then x = true : x = true
+Call ok(x = false, "x <> false")
+
if false then
ok false, "if false called"
end if
@@ -481,6 +486,17 @@
next
Call ok(y = 1, "y = " & y)
Call ok(x = 2, "x = " & x)
+
+Set obj = collectionObj
+Call obj.reset()
+y = 0
+x = 10
+for each x in obj
+ y = y+1
+ Call ok(x = y, "x <> y")
+next
+Call ok(y = 3, "y = " & y)
+Call ok(getVT(x) = "VT_EMPTY*", "getVT(x) = " & getVT(x))
x = false
select case 3
@@ -538,6 +554,22 @@
select case 0
end select
+x = false
+select case 2
+ case 3,1,2,4: x = true
+ case 5,6,7
+ Call ok(false, "unexpected case")
+end select
+Call ok(x, "wrong case")
+
+x = false
+select case 2: case 5,6,7: Call ok(false, "unexpected case")
+ case 2,1,2,4
+ x = true
+ case else: Call ok(false, "unexpected case else")
+end select
+Call ok(x, "wrong case")
+
if false then
Sub testsub
x = true
@@ -747,7 +779,6 @@
set x = testObj
Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x=testObj) = " &
getVT(x))
-Dim obj
Set obj = New EmptyClass
Call ok(getVT(obj) = "VT_DISPATCH*", "getVT(obj) = " &
getVT(obj))
@@ -814,6 +845,9 @@
Public Sub Class_Initialize
publicProp2 = 2
privateProp = true
+ Call ok(getVT(privateProp) = "VT_BOOL*", "getVT(privateProp) =
" & getVT(privateProp))
+ Call ok(getVT(publicProp2) = "VT_I2*", "getVT(publicProp2) =
" & getVT(publicProp2))
+ Call ok(getVT(Me.publicProp2) = "VT_I2", "getVT(Me.publicProp2) =
" & getVT(Me.publicProp2))
End Sub
End Class
@@ -830,6 +864,7 @@
Call ok(getVT(obj.publicProp) = "VT_EMPTY", "getVT(obj.publicProp) =
" & getVT(obj.publicProp))
obj.publicProp = 3
+Call ok(getVT(obj.publicProp) = "VT_I2", "getVT(obj.publicProp) = "
& getVT(obj.publicProp))
Call ok(obj.publicProp = 3, "obj.publicProp = " & obj.publicProp)
obj.publicProp() = 3
@@ -964,7 +999,6 @@
Function Property()
End Function
-
Sub Test(property)
End Sub
@@ -972,4 +1006,142 @@
End Sub
End Class
+' Array tests
+
+Call ok(getVT(arr) = "VT_EMPTY*", "getVT(arr) = " & getVT(arr))
+
+Dim arr(3)
+Dim arr2(4,3), arr3(5,4,3), arr0(0), noarr()
+
+Call ok(getVT(arr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr) = "
& getVT(arr))
+Call ok(getVT(arr2) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr2) =
" & getVT(arr2))
+Call ok(getVT(arr0) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr0) =
" & getVT(arr0))
+Call ok(getVT(noarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(noarr) =
" & getVT(noarr))
+
+Call testArray(1, arr)
+Call testArray(2, arr2)
+Call testArray(3, arr3)
+Call testArray(0, arr0)
+Call testArray(-1, noarr)
+
+Call ok(getVT(arr(1)) = "VT_EMPTY*", "getVT(arr(1)) = " &
getVT(arr(1)))
+Call ok(getVT(arr2(1,2)) = "VT_EMPTY*", "getVT(arr2(1,2)) = " &
getVT(arr2(1,2)))
+Call ok(getVT(arr3(1,2,2)) = "VT_EMPTY*", "getVT(arr3(1,2,3)) = "
& getVT(arr3(1,2,2)))
+Call ok(getVT(arr(0)) = "VT_EMPTY*", "getVT(arr(0)) = " &
getVT(arr(0)))
+Call ok(getVT(arr(3)) = "VT_EMPTY*", "getVT(arr(3)) = " &
getVT(arr(3)))
+Call ok(getVT(arr0(0)) = "VT_EMPTY*", "getVT(arr0(0)) = " &
getVT(arr0(0)))
+
+arr(2) = 3
+Call ok(arr(2) = 3, "arr(2) = " & arr(2))
+Call ok(getVT(arr(2)) = "VT_I2*", "getVT(arr(2)) = " &
getVT(arr(2)))
+
+arr3(3,2,1) = 1
+arr3(1,2,3) = 2
+Call ok(arr3(3,2,1) = 1, "arr3(3,2,1) = " & arr3(3,2,1))
+Call ok(arr3(1,2,3) = 2, "arr3(1,2,3) = " & arr3(1,2,3))
+
+x = arr3
+Call ok(x(3,2,1) = 1, "x(3,2,1) = " & x(3,2,1))
+
+Function getarr()
+ Dim arr(3)
+ arr(2) = 2
+ getarr = arr
+ arr(3) = 3
+End Function
+
+x = getarr()
+Call ok(getVT(x) = "VT_ARRAY|VT_VARIANT*", "getVT(x) = " &
getVT(x))
+Call ok(x(2) = 2, "x(2) = " & x(2))
+Call ok(getVT(x(3)) = "VT_EMPTY*", "getVT(x(3)) = " &
getVT(x(3)))
+
+x(1) = 1
+Call ok(x(1) = 1, "x(1) = " & x(1))
+x = getarr()
+Call ok(getVT(x(1)) = "VT_EMPTY*", "getVT(x(1)) = " &
getVT(x(1)))
+Call ok(x(2) = 2, "x(2) = " & x(2))
+
+x(1) = 1
+y = x
+x(1) = 2
+Call ok(y(1) = 1, "y(1) = " & y(1))
+
+for x=1 to 1
+ Dim forarr(3)
+ if x=1 then
+ Call ok(getVT(forarr(1)) = "VT_EMPTY*", "getVT(forarr(1)) = "
& getVT(forarr(1)))
+ else
+ Call ok(forarr(1) = x, "forarr(1) = " & forarr(1))
+ end if
+ forarr(1) = x+1
+next
+
+x=1
+Call ok(forarr(x) = 2, "forarr(x) = " & forarr(x))
+
+Class ArrClass
+ Dim classarr(3)
+ Dim classnoarr()
+ Dim var
+
+ Private Sub Class_Initialize
+ Call ok(getVT(classarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*",
"getVT(classarr) = " & getVT(classarr))
+ Call testArray(-1, classnoarr)
+ classarr(0) = 1
+ classarr(1) = 2
+ classarr(2) = 3
+ classarr(3) = 4
+ End Sub
+
+ Public Sub testVarVT
+ Call ok(getVT(var) = "VT_ARRAY|VT_VARIANT*", "getVT(var) = "
& getVT(var))
+ End Sub
+End Class
+
+Set obj = new ArrClass
+Call ok(getVT(obj.classarr) = "VT_ARRAY|VT_VARIANT", "getVT(obj.classarr)
= " & getVT(obj.classarr))
+'todo_wine Call ok(obj.classarr(1) = 2, "obj.classarr(1) = " &
obj.classarr(1))
+
+obj.var = arr
+Call ok(getVT(obj.var) = "VT_ARRAY|VT_VARIANT", "getVT(obj.var) = "
& getVT(obj.var))
+Call obj.testVarVT
+
+Sub arrarg(byref refarr, byval valarr, byref refarr2, byval valarr2)
+ Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*",
"getVT(refarr) = " & getVT(refarr))
+ Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) =
" & getVT(valarr))
+ Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) =
" & getVT(refarr2))
+ Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) =
" & getVT(valarr2))
+End Sub
+
+Call arrarg(arr, arr, obj.classarr, obj.classarr)
+
+Sub arrarg2(byref refarr(), byval valarr(), byref refarr2(), byval valarr2())
+ Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*",
"getVT(refarr) = " & getVT(refarr))
+ Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) =
" & getVT(valarr))
+ Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) =
" & getVT(refarr2))
+ Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) =
" & getVT(valarr2))
+End Sub
+
+Call arrarg2(arr, arr, obj.classarr, obj.classarr)
+
+Sub testarrarg(arg(), vt)
+ Call ok(getVT(arg) = vt, "getVT() = " & getVT(arg) & "
expected " & vt)
+End Sub
+
+Call testarrarg(1, "VT_I2*")
+Call testarrarg(false, "VT_BOOL*")
+Call testarrarg(Empty, "VT_EMPTY*")
+
+' It's allowed to declare non-builtin RegExp class...
+class RegExp
+ public property get Global()
+ Call ok(false, "Global called")
+ Global = "fail"
+ end property
+end class
+
+' ...but there is no way to use it because builtin instance is always created
+set x = new RegExp
+Call ok(x.Global = false, "x.Global = " & x.Global)
+
reportSuccess()
Modified: trunk/rostests/winetests/vbscript/regexp.vbs
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/vbscript/regexp…
==============================================================================
--- trunk/rostests/winetests/vbscript/regexp.vbs [iso-8859-1] (original)
+++ trunk/rostests/winetests/vbscript/regexp.vbs [iso-8859-1] Wed Apr 23 18:06:48 2014
@@ -168,4 +168,10 @@
Call ok(submatch.Item(0) = "a", "submatch.Item(0) = " &
submatch.Item(0))
Call ok(submatch.Item(1) = "b", "submatch.Item(0) = " &
submatch.Item(1))
+Set x = new regexp
+Call ok(x.Pattern = "", "RegExp.Pattern = " & x.Pattern)
+Call ok(x.IgnoreCase = false, "RegExp.IgnoreCase = " & x.IgnoreCase)
+Call ok(x.Global = false, "RegExp.Global = " & x.Global)
+Call ok(x.Multiline = false, "RegExp.Multiline = " & x.Multiline)
+
Call reportSuccess()
Modified: trunk/rostests/winetests/vbscript/rsrc.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/vbscript/rsrc.r…
==============================================================================
--- trunk/rostests/winetests/vbscript/rsrc.rc [iso-8859-1] (original)
+++ trunk/rostests/winetests/vbscript/rsrc.rc [iso-8859-1] Wed Apr 23 18:06:48 2014
@@ -19,6 +19,9 @@
/* @makedep: api.vbs */
api.vbs 40 "api.vbs"
+/* @makedep: error.vbs */
+error.vbs 40 "error.vbs"
+
/* @makedep: lang.vbs */
lang.vbs 40 "lang.vbs"
Modified: trunk/rostests/winetests/vbscript/run.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/vbscript/run.c?…
==============================================================================
--- trunk/rostests/winetests/vbscript/run.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/vbscript/run.c [iso-8859-1] Wed Apr 23 18:06:48 2014
@@ -119,11 +119,16 @@
#define DISPID_GLOBAL_PROPARGPUT1 1012
#define DISPID_GLOBAL_COLLOBJ 1013
#define DISPID_GLOBAL_DOUBLEASSTRING 1014
+#define DISPID_GLOBAL_TESTARRAY 1015
+#define DISPID_GLOBAL_THROWINT 1016
#define DISPID_TESTOBJ_PROPGET 2000
#define DISPID_TESTOBJ_PROPPUT 2001
#define DISPID_COLLOBJ_RESET 3000
+
+#define FACILITY_VBS 0xa
+#define MAKE_VBSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code)
static const WCHAR testW[] = {'t','e','s','t',0};
static const WCHAR emptyW[] = {0};
@@ -150,18 +155,6 @@
CHAR buf[512];
WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0);
return lstrcmpA(buf, stra);
-}
-
-static const char *debugstr_guid(REFIID riid)
-{
- static char buf[50];
-
- sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
- riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
- riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
- riid->Data4[5], riid->Data4[6], riid->Data4[7]);
-
- return buf;
}
static const char *vt2a(VARIANT *v)
@@ -193,6 +186,8 @@
return "VT_BOOL";
case VT_ARRAY|VT_VARIANT:
return "VT_ARRAY|VT_VARIANT";
+ case VT_ARRAY|VT_BYREF|VT_VARIANT:
+ return "VT_ARRAY|VT_BYREF|VT_VARIANT";
default:
ok(0, "unknown vt %d\n", V_VT(v));
return NULL;
@@ -241,7 +236,7 @@
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID
guidService,
REFIID riid, void **ppv)
{
- ok(0, "unexpected service %s\n", debugstr_guid(guidService));
+ ok(0, "unexpected service %s\n", wine_dbgstr_guid(guidService));
return E_NOINTERFACE;
}
@@ -446,6 +441,26 @@
IDispatchEx_Release(dispex);
}
+static void test_safearray(SAFEARRAY *safearray, unsigned indims)
+{
+ int i, exdims = indims;
+
+ if(!exdims)
+ exdims = 1;
+ ok(safearray->cDims == exdims, "safearray->cDims = %d, expected
%d\n", safearray->cDims, exdims);
+ todo_wine
+ ok(safearray->fFeatures ==
(FADF_VARIANT|FADF_HAVEVARTYPE|FADF_FIXEDSIZE|FADF_STATIC),
+ "safearray->fFeatures = %x\n", safearray->fFeatures);
+ ok(safearray->cbElements == sizeof(VARIANT), "safearray->cbElements =
%x\n", safearray->cbElements);
+ ok(!safearray->cLocks, "safearray->cLocks = %x\n",
safearray->cLocks);
+
+ for(i=0; i < safearray->cDims; i++) {
+ ok(safearray->rgsabound[i].cElements == indims ? i+4 : 1,
"safearray->rgsabound[%d].cElements = %d\n", i,
+ safearray->rgsabound[i].cElements);
+ ok(!safearray->rgsabound[i].lLbound, "safearray->rgsabound[%d].lLbound
= %d\n", i, safearray->rgsabound[i].lLbound);
+ }
+}
+
#define test_grfdex(a,b) _test_grfdex(__LINE__,a,b)
static void _test_grfdex(unsigned line, DWORD grfdex, DWORD expect)
{
@@ -466,7 +481,7 @@
return S_OK;
}
- ok(0, "unexpected call %s\n", debugstr_guid(riid));
+ ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
return E_NOINTERFACE;
}
@@ -539,7 +554,7 @@
|| IsEqualGUID(riid, &IID_IDispatchEx))
*ppv = iface;
else {
- trace("QI %s\n", debugstr_guid(riid));
+ trace("QI %s\n", wine_dbgstr_guid(riid));
return E_NOINTERFACE;
}
@@ -913,6 +928,16 @@
*pid = DISPID_GLOBAL_DOUBLEASSTRING;
return S_OK;
}
+ if(!strcmp_wa(bstrName, "testArray")) {
+ test_grfdex(grfdex, fdexNameCaseInsensitive);
+ *pid = DISPID_GLOBAL_TESTARRAY;
+ return S_OK;
+ }
+ if(!strcmp_wa(bstrName, "throwInt")) {
+ test_grfdex(grfdex, fdexNameCaseInsensitive);
+ *pid = DISPID_GLOBAL_THROWINT;
+ return S_OK;
+ }
if(strict_dispid_check && strcmp_wa(bstrName, "x"))
ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
@@ -1171,6 +1196,61 @@
V_VT(pvarRes) = VT_BSTR;
return VarBstrFromR8(V_R8(pdp->rgvarg), 0, 0, &V_BSTR(pvarRes));
+
+ case DISPID_GLOBAL_TESTARRAY:
+ ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags);
+ ok(pdp != NULL, "pdp == NULL\n");
+ ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
+ ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
+ ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
+ ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
+ ok(!pvarRes, "pvarRes != NULL\n");
+ ok(pei != NULL, "pei == NULL\n");
+
+ ok(V_VT(pdp->rgvarg+1) == VT_I2, "V_VT(psp->rgvargs+1) = %d\n",
V_VT(pdp->rgvarg+1));
+ ok(V_VT(pdp->rgvarg) == (VT_BYREF|VT_VARIANT), "V_VT(psp->rgvargs) =
%d\n", V_VT(pdp->rgvarg));
+ ok(V_VT(V_VARIANTREF(pdp->rgvarg)) == (VT_ARRAY|VT_BYREF|VT_VARIANT),
+ "V_VT(V_VARIANTREF(psp->rgvargs)) = %d\n",
V_VT(V_VARIANTREF(pdp->rgvarg)));
+ if(V_I2(pdp->rgvarg+1) == -1)
+ ok(!*V_ARRAYREF(V_VARIANTREF(pdp->rgvarg)),
"*V_ARRAYREF(V_VARIANTREF(pdp->rgvarg)) != NULL\n");
+ else
+ test_safearray(*V_ARRAYREF(V_VARIANTREF(pdp->rgvarg)),
V_I2(pdp->rgvarg+1));
+ return S_OK;
+
+ case DISPID_GLOBAL_THROWINT: {
+ VARIANT *v = pdp->rgvarg;
+ HRESULT hres;
+
+ ok((wFlags & ~INVOKE_PROPERTYGET) == INVOKE_FUNC, "wFlags = %x\n",
wFlags);
+ ok(pdp != NULL, "pdp == NULL\n");
+ ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
+ ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
+ ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
+ ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
+ ok(pei != NULL, "pei == NULL\n");
+ if(pvarRes) {
+ ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n",
V_VT(pvarRes));
+ V_VT(pvarRes) = VT_BOOL;
+ V_BOOL(pvarRes) = VARIANT_FALSE;
+ }
+
+ if(V_VT(v) == (VT_VARIANT|VT_BYREF))
+ v = V_VARIANTREF(v);
+
+ switch(V_VT(v)) {
+ case VT_I2:
+ hres = V_I2(v);
+ break;
+ case VT_I4:
+ hres = V_I4(v);
+ break;
+ default:
+ ok(0, "unexpected vt %d\n", V_VT(v));
+ return E_INVALIDARG;
+ }
+
+ return hres;
+ }
}
ok(0, "unexpected call %d\n", id);
@@ -1733,7 +1813,7 @@
size = GetFileSize(file, NULL);
- map = CreateFileMapping(file, NULL, PAGE_READONLY, 0, 0, NULL);
+ map = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
CloseHandle(file);
if(map == INVALID_HANDLE_VALUE) {
trace("Could not create file mapping: %u\n", GetLastError());
@@ -1912,6 +1992,20 @@
test_global_vars_ref(TRUE);
test_global_vars_ref(FALSE);
+ hres = parse_script_ar("throwInt(&h80080008&)");
+ ok(hres == 0x80080008, "hres = %08x\n", hres);
+
+ /* DISP_E_BADINDEX */
+ hres = parse_script_ar("throwInt(&h8002000b&)");
+ ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres);
+
+ hres = parse_script_ar("throwInt(&h800a0009&)");
+ ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres);
+
+ /* E_NOTIMPL */
+ hres = parse_script_ar("throwInt(&h80004001&)");
+ ok(hres == MAKE_VBSERROR(445), "hres = %08x\n", hres);
+
strict_dispid_check = FALSE;
parse_script_a("Sub testsub\n"
@@ -1931,6 +2025,7 @@
run_from_res("lang.vbs");
run_from_res("api.vbs");
run_from_res("regexp.vbs");
+ run_from_res("error.vbs");
test_procedures();
test_gc();