Jacek Caban : vbscript/tests: Add with statement tests.
Alexandre Julliard
julliard at winehq.org
Tue Oct 29 17:41:47 CDT 2019
Module: wine
Branch: master
Commit: 666f7501d03983f84833a7a1952e78fd0650fde6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=666f7501d03983f84833a7a1952e78fd0650fde6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Oct 29 19:01:35 2019 +0100
vbscript/tests: Add with statement tests.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/vbscript/tests/error.vbs | 71 +++++++++++++++++++++++++++++++++++++++++++
dlls/vbscript/tests/lang.vbs | 15 +++++++++
dlls/vbscript/tests/run.c | 12 ++++++++
3 files changed, 98 insertions(+)
diff --git a/dlls/vbscript/tests/error.vbs b/dlls/vbscript/tests/error.vbs
index 78314c3569..13f9a2072e 100644
--- a/dlls/vbscript/tests/error.vbs
+++ b/dlls/vbscript/tests/error.vbs
@@ -77,6 +77,13 @@ const CO_E_SERVER_EXEC_FAILURE = &h80080005&
call ok(Err.Number = 0, "Err.Number = " & Err.Number)
call ok(getVT(Err.Number) = "VT_I4", "getVT(Err.Number) = " & getVT(Err.Number))
+class emptyclass
+end class
+
+class propclass
+ public prop
+end class
+
dim calledFunc
sub returnTrue
@@ -313,6 +320,70 @@ end sub
call testForEachError()
+sub testWithError()
+ on error resume next
+ dim x
+
+ err.clear
+ x = false
+ with throwInt(E_TESTERROR)
+ ok Err.Number = E_TESTERROR, "Err.Number = " & Err.Number
+ x = true
+ end with
+ ok x, "with statement body not executed"
+
+ err.clear
+ x = false
+ with throwInt(E_TESTERROR)
+ x = true
+ .prop = 1
+ todo_wine_ok Err.Number = 424, "Err.Number = " & Err.Number
+ end with
+ ok x, "with statement body not executed"
+
+ err.clear
+ x = false
+ with empty
+ .prop = 1
+ todo_wine_ok Err.Number = 424, "Err.Number = " & Err.Number
+ x = true
+ end with
+ ok x, "with statement body not executed"
+end sub
+
+sub testWithError2()
+ on error resume next
+ dim x
+
+ err.clear
+ x = false
+ with new emptyclass
+ .prop = 1
+ ok Err.Number = 438, "Err.Number = " & Err.Number
+ x = true
+ end with
+ ok x, "with statement body not executed"
+
+ 'dot expression can reference only inner-most with statement
+ err.clear
+ x = false
+ with new propclass
+ with new emptyclass
+ .prop = 1
+ ok Err.Number = 438, "Err.Number = " & Err.Number
+ x = true
+ end with
+ end with
+ ok x, "with statement body not executed"
+
+ err.clear
+ .prop
+ ok Err.Number = 505, "Err.Number = " & Err.Number & " description """ & err.description & """"
+end sub
+
+call testWithError()
+call testWithError2()
+
sub testHresMap(hres, code)
on error resume next
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 8027264bf5..f7cdc92ec4 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -1568,4 +1568,19 @@ call ok(x.getProp.prop.prop = 3, "x.getProp.prop.prop = " & x.getProp.prop.prop)
ok getVT(x) = "VT_DISPATCH*", "getVT(x) = " & getVT(x)
todo_wine_ok getVT(x()) = "VT_BSTR", "getVT(x()) = " & getVT(x())
+with nothing
+end with
+
+set x = new TestPropSyntax
+with x
+ .prop = 1
+ ok .prop = 1, ".prop = "&.prop
+end with
+ok x.prop = 1, "x.prop = " & x.prop
+
+with new TestPropSyntax
+ .prop = 1
+ ok .prop = 1, ".prop = "&.prop
+end with
+
reportSuccess()
diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c
index 2c0ccdd25b..19b562852d 100644
--- a/dlls/vbscript/tests/run.c
+++ b/dlls/vbscript/tests/run.c
@@ -2920,6 +2920,18 @@ static void run_tests(void)
CHECK_CALLED(global_propargput1_d);
CHECK_CALLED(global_propargput1_i);
+ SET_EXPECT(testobj_propget_d);
+ SET_EXPECT(testobj_propget_i);
+ parse_script_a("dim x\nwith testObj\nx=1+.propget\nend with");
+ CHECK_CALLED(testobj_propget_d);
+ CHECK_CALLED(testobj_propget_i);
+
+ SET_EXPECT(testobj_propput_d);
+ SET_EXPECT(testobj_propput_i);
+ parse_script_a("with testObj\n.propput = 1\nend with");
+ CHECK_CALLED(testobj_propput_d);
+ CHECK_CALLED(testobj_propput_i);
+
parse_htmlscript_a("<!--");
parse_htmlscript_a(" -->");
parse_htmlscript_a("<!--\ndim x\nx=1\n-->\n");
More information about the wine-cvs
mailing list