Module: wine Branch: master Commit: 6cc7b0e8d5013bdc492ff1f31c2c2aa82351b30e URL: https://source.winehq.org/git/wine.git/?a=commit;h=6cc7b0e8d5013bdc492ff1f31...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Aug 21 20:22:18 2019 +0200
vbscript: Return correct error when builtin call argument count is invalid.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/vbscript/tests/api.vbs | 22 ++++++++++++++++++++++ dlls/vbscript/vbdisp.c | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index 8ebbfb6..b252d58 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -237,6 +237,17 @@ Call ok(UBound(arr2) = 2, "UBound(x) = " & UBound(x)) Call ok(UBound(arr2, 1) = 2, "UBound(x) = " & UBound(x)) Call ok(UBound(arr2, 2) = 4, "UBound(x) = " & UBound(x))
+sub testUBoundError() + on error resume next + call Err.clear() + call UBound() + call ok(Err.number = 450, "Err.number = " & Err.number) + call Err.clear() + call UBound(arr, 1, 2) + call ok(Err.number = 450, "Err.number = " & Err.number) +end sub +call testUBoundError() + Dim newObject Set newObject = New ValClass newObject.myval = 1 @@ -494,6 +505,17 @@ TestStrComp "ABC", Empty, 1, 1 TestStrComp vbNull, vbNull, 1, 0 TestStrComp "", vbNull, 1, -1
+sub testStrCompError() + on error resume next + call Err.clear() + call StrComp() + call ok(Err.number = 450, "Err.number = " & Err.number) + call Err.clear() + call StrComp("a", "a", 0, 1) + call ok(Err.number = 450, "Err.number = " & Err.number) +end sub +call testStrCompError() + Call ok(Len("abc") = 3, "Len(abc) = " & Len("abc")) Call ok(Len("") = 0, "Len() = " & Len("")) Call ok(Len(1) = 1, "Len(1) = " & Len(1)) diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index d781dbc..a907f40 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -232,8 +232,8 @@ static HRESULT invoke_builtin(vbdisp_t *This, const builtin_prop_t *prop, WORD f argn = arg_cnt(dp);
if(argn < prop->min_args || argn > (prop->max_args ? prop->max_args : prop->min_args)) { - FIXME("invalid number of arguments\n"); - return E_FAIL; + WARN("invalid number of arguments\n"); + return MAKE_VBSERROR(VBSE_FUNC_ARITY_MISMATCH); }
assert(argn < ARRAY_SIZE(args));