[PATCH 0/1] MR10589: vbscript: Add missing runtime error constants and tests.
Add VBSE_DUPLICATE_KEY (457) and VBSE_CLASS_NOT_DEFINED (506) error code definitions with their string resources, and add tests for runtime errors 11, 94, 429, 451, 457, and 506. Errors 94 and 506 are marked todo_wine as Wine currently returns incorrect error codes for those cases. Error 28 (out of stack space) is included commented out as Wine crashes with a stack overflow instead of raising the error. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10589
From: Francis De Brabandere <francisdb@gmail.com> Add VBSE_DUPLICATE_KEY (457) and VBSE_CLASS_NOT_DEFINED (506) error code definitions with their string resources, and add tests for runtime errors 11, 94, 429, 451, 457, and 506. Errors 94 and 506 are marked todo_wine as Wine currently returns incorrect error codes for those cases. Error 28 (out of stack space) is included commented out as Wine crashes with a stack overflow instead of raising the error. --- dlls/vbscript/tests/lang.vbs | 51 +++++++++++++++++++++++++++++++++++ dlls/vbscript/vbscript.rc | 2 ++ dlls/vbscript/vbscript_defs.h | 2 ++ 3 files changed, 55 insertions(+) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index cce5b02e9cb..376acd65791 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -3124,4 +3124,55 @@ Call ok(Err.Number = 13, "bool var as statement: err = " & Err.Number) On Error GoTo 0 +' Tests for missing runtime error codes +On Error Resume Next + +' Error 28: Out of stack space (infinite recursion) +' Disabled: crashes Wine with a stack overflow instead of raising error 28. +'Sub RecurseForever() : RecurseForever : End Sub +'Err.Clear +'RecurseForever +'todo_wine_ok Err.Number = 28, "infinite recursion: err.number = " & Err.Number + +' Error 11: Division by zero +Err.Clear +Dim divZeroResult +divZeroResult = 1 \ 0 +Call ok(Err.Number = 11, "division by zero: err.number = " & Err.Number) + +' Error 94: Invalid use of Null +Err.Clear +Dim nullResult +nullResult = CLng(Null) +todo_wine_ok Err.Number = 94, "CLng(Null): err.number = " & Err.Number + +' Error 429: ActiveX component can't create object +Err.Clear +Dim badObj +Set badObj = CreateObject("No.Such.Object.XXXXXX") +Call ok(Err.Number = 429, "CreateObject bad ProgID: err.number = " & Err.Number) + +' Error 451: Object not a collection +Err.Clear +Dim forEachVar +For Each forEachVar In 42 +Next +Call ok(Err.Number = 451, "For Each over integer: err.number = " & Err.Number) + +' Error 457: Duplicate key in Dictionary +Err.Clear +Dim dictObj +Set dictObj = CreateObject("Scripting.Dictionary") +dictObj.Add "key1", 1 +dictObj.Add "key1", 2 +Call ok(Err.Number = 457, "duplicate Dictionary key: err.number = " & Err.Number) + +' Error 506: Class not defined +Err.Clear +Dim undefinedClassObj +Set undefinedClassObj = New NoSuchClass +todo_wine_ok Err.Number = 506, "New undefined class: err.number = " & Err.Number + +On Error GoTo 0 + reportSuccess() diff --git a/dlls/vbscript/vbscript.rc b/dlls/vbscript/vbscript.rc index 5e3adddc789..4fff1b4cec1 100644 --- a/dlls/vbscript/vbscript.rc +++ b/dlls/vbscript/vbscript.rc @@ -56,12 +56,14 @@ STRINGTABLE VBSE_PARAMETER_NOT_OPTIONAL "Argument not optional" VBSE_FUNC_ARITY_MISMATCH "Wrong number of arguments or invalid property assignment" VBSE_NOT_ENUM "Object not a collection" + VBSE_DUPLICATE_KEY "This key is already associated with an element of this collection" VBSE_INVALID_DLL_FUNCTION_NAME "Specified DLL function not found" VBSE_INVALID_TYPELIB_VARIABLE "Variable uses an Automation type not supported in VBScript" VBSE_SERVER_NOT_FOUND "The remote server machine does not exist or is unavailable" VBSE_VARIABLE_UNDEFINED "Variable is undefined" VBSE_ILLEGAL_ASSIGNMENT "Illegal assignment" VBSE_UNQUALIFIED_REFERENCE "Invalid or unqualified reference" + VBSE_CLASS_NOT_DEFINED "Class not defined" VBSE_SYNTAX_ERROR "Syntax error" VBSE_EXPECTED_LPAREN "Expected '('" VBSE_EXPECTED_IDENTIFIER "Expected identifier" diff --git a/dlls/vbscript/vbscript_defs.h b/dlls/vbscript/vbscript_defs.h index 0dc7b677517..fea26e716da 100644 --- a/dlls/vbscript/vbscript_defs.h +++ b/dlls/vbscript/vbscript_defs.h @@ -267,12 +267,14 @@ #define VBSE_PARAMETER_NOT_OPTIONAL 449 #define VBSE_FUNC_ARITY_MISMATCH 450 #define VBSE_NOT_ENUM 451 +#define VBSE_DUPLICATE_KEY 457 #define VBSE_INVALID_DLL_FUNCTION_NAME 453 #define VBSE_INVALID_TYPELIB_VARIABLE 458 #define VBSE_SERVER_NOT_FOUND 462 #define VBSE_VARIABLE_UNDEFINED 500 #define VBSE_ILLEGAL_ASSIGNMENT 501 #define VBSE_UNQUALIFIED_REFERENCE 505 +#define VBSE_CLASS_NOT_DEFINED 506 #define VBSE_SYNTAX_ERROR 1002 #define VBSE_EXPECTED_LPAREN 1005 #define VBSE_EXPECTED_IDENTIFIER 1010 -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10589
participants (2)
-
Francis De Brabandere -
Francis De Brabandere (@francisdb)