Jacek Caban : vbscript/tests: Add err.raise tests.
Alexandre Julliard
julliard at winehq.org
Thu Oct 3 16:44:01 CDT 2019
Module: wine
Branch: master
Commit: ea130e12c3fa071b905020f86cc7ca5c05370a81
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ea130e12c3fa071b905020f86cc7ca5c05370a81
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Oct 3 18:19:34 2019 +0200
vbscript/tests: Add err.raise tests.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/vbscript/tests/api.vbs | 88 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index 1b5c38cdd9..12e9f475f5 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -1522,4 +1522,92 @@ call testAsc(Chr(0), 0)
if isEnglishLang then testAsc true, 84
call testAscError()
+sub testErrNumber(n)
+ call ok(err.number = n, "err.number = " & err.number & " expected " & n)
+end sub
+
+sub testErrRaise()
+ on error resume next
+ call ok(err.number = 0, "err.number = " & err.number)
+ err.raise 1
+ call ok(err.number = 1, "err.number = " & err.number)
+ err.raise
+ call ok(err.number = 450, "err.number = " & err.number)
+ call testErrNumber(450)
+ err.raise &h10000&
+ call ok(err.number = 5, "err.number = " & err.number)
+
+ err.clear
+ call ok(getVT(err.source) = "VT_BSTR", "err.source = " & err.source)
+ call ok(getVT(err.description) = "VT_BSTR", "err.description = " & err.description)
+ call ok(getVT(err.helpfile) = "VT_BSTR", "err.helpfile = " & err.helpfile)
+ call ok(getVT(err.helpcontext) = "VT_I4", "err.helpcontext = " & err.helpcontext)
+ call ok(err.source = "", "err.source = " & err.source)
+ call ok(err.description = "", "err.description = " & err.description)
+ call ok(err.helpfile = "", "err.helpfile = " & err.helpfile)
+ call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext)
+
+ err.raise 1, "abc"
+ call ok(err.number = 1, "err.number = " & err.number)
+ call ok(err.source = "abc", "err.source = " & err.source)
+ if isEnglishLang then call ok(err.description = "Unknown runtime error", "err.description = " & err.description)
+ call ok(err.helpfile = "", "err.helpfile = " & err.helpfile)
+
+ err.raise 1, 2, "desc", "hf", 1
+ call ok(err.number = 1, "err.number = " & err.number)
+ call ok(getVT(err.source) = "VT_BSTR", "err.source = " & err.source)
+ call ok(err.source = "2", "err.source = " & err.source)
+ call ok(err.description = "desc", "err.description = " & err.description)
+ call ok(err.helpfile = "hf", "err.helpfile = " & err.helpfile)
+ call ok(getVT(err.helpcontext) = "VT_I4", "err.helpcontext = " & err.helpcontext)
+ call ok(err.helpcontext = 1, "err.helpcontext = " & err.helpcontext)
+
+ err.raise 5
+ call ok(err.number = 5, "err.number = " & err.number)
+ call ok(err.source = "2", "err.source = " & err.source)
+ call ok(err.description = "desc", "err.description = " & err.description)
+ call ok(err.helpfile = "hf", "err.helpfile = " & err.helpfile)
+ call ok(getVT(err.helpcontext) = "VT_I4", "err.helpcontext = " & err.helpcontext)
+ call ok(err.helpcontext = 1, "err.helpcontext = " & err.helpcontext)
+
+ err.clear
+ err.raise &h8007000E&
+ call ok(err.number = 7, "err.number = " & err.number)
+ if isEnglishLang then call ok(err.source = "Microsoft VBScript runtime error", "err.source = " & err.source)
+ if isEnglishLang then call ok(err.description = "Out of memory", "err.description = " & err.description)
+ call ok(err.helpfile = "", "err.helpfile = " & err.helpfile)
+ call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext)
+
+ err.clear
+ err.raise 1, "test"
+ err.raise &h8007000E&
+ call ok(err.number = 7, "err.number = " & err.number)
+ call ok(err.source = "test", "err.source = " & err.source)
+ if isEnglishLang then call ok(err.description = "Unknown runtime error", "err.description = " & err.description)
+ call ok(err.helpfile = "", "err.helpfile = " & err.helpfile)
+ call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext)
+
+ err.raise 1, 2, "desc", "hf", 1
+ err.unknownIdent
+ call ok(err.number = 438, "err.number = " & err.number)
+ if isEnglishLang then call ok(err.source = "Microsoft VBScript runtime error", "err.source = " & err.source)
+ if isEnglishLang then call ok(err.description = "Object doesn't support this property or method", _
+ "err.description = " & err.description)
+ call ok(err.helpfile = "", "err.helpfile = " & err.helpfile)
+ call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext)
+
+ e = err
+ call ok(getVT(e) = "VT_I4*", "getVT(e) = " & getVT(e))
+ call ok(e = 438, "e = " & e)
+
+ err.raise 1, 2, "desc", "hf", 1
+ on error goto 0
+ call ok(err.number = 0, "err.number = " & err.number)
+ call ok(err.source = "", "err.source = " & err.source)
+ call ok(err.description = "", "err.description = " & err.description)
+ call ok(err.helpfile = "", "err.helpfile = " & err.helpfile)
+ call ok(err.helpcontext = 0, "err.helpcontext = " & err.helpcontext)
+end sub
+call testErrRaise()
+
Call reportSuccess()
More information about the wine-cvs
mailing list