vbscript/tests: Added more error tests.
This commit is contained in:
parent
4effb57f88
commit
bdd1fcd89e
|
@ -23,6 +23,57 @@ 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
|
||||
|
@ -247,4 +298,77 @@ 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()
|
||||
|
|
|
@ -120,6 +120,9 @@ DEFINE_EXPECT(EnableModeless);
|
|||
|
||||
#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};
|
||||
|
||||
|
@ -1224,6 +1227,9 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
|||
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);
|
||||
|
@ -1236,7 +1242,6 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
|||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
trace("throwing %08x (%d)\n", hres, hres);
|
||||
return hres;
|
||||
}
|
||||
}
|
||||
|
@ -1983,6 +1988,17 @@ static void run_tests(void)
|
|||
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"
|
||||
|
|
Loading…
Reference in New Issue