vbscript/tests: Add with statement tests.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e8b2f85bb1
commit
666f7501d0
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue