Commit 666f7501 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript/tests: Add with statement tests.

parent e8b2f85b
...@@ -77,6 +77,13 @@ const CO_E_SERVER_EXEC_FAILURE = &h80080005& ...@@ -77,6 +77,13 @@ const CO_E_SERVER_EXEC_FAILURE = &h80080005&
call ok(Err.Number = 0, "Err.Number = " & Err.Number) call ok(Err.Number = 0, "Err.Number = " & Err.Number)
call ok(getVT(Err.Number) = "VT_I4", "getVT(Err.Number) = " & getVT(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 dim calledFunc
sub returnTrue sub returnTrue
...@@ -313,6 +320,70 @@ end sub ...@@ -313,6 +320,70 @@ end sub
call testForEachError() 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) sub testHresMap(hres, code)
on error resume next on error resume next
......
...@@ -1568,4 +1568,19 @@ call ok(x.getProp.prop.prop = 3, "x.getProp.prop.prop = " & x.getProp.prop.prop) ...@@ -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) ok getVT(x) = "VT_DISPATCH*", "getVT(x) = " & getVT(x)
todo_wine_ok getVT(x()) = "VT_BSTR", "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() reportSuccess()
...@@ -2920,6 +2920,18 @@ static void run_tests(void) ...@@ -2920,6 +2920,18 @@ static void run_tests(void)
CHECK_CALLED(global_propargput1_d); CHECK_CALLED(global_propargput1_d);
CHECK_CALLED(global_propargput1_i); 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(" -->"); parse_htmlscript_a(" -->");
parse_htmlscript_a("<!--\ndim x\nx=1\n-->\n"); parse_htmlscript_a("<!--\ndim x\nx=1\n-->\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment