[VBSCRIPT_WINETEST] Sync with Wine 3.0. CORE-14225

This commit is contained in:
Amine Khaldi 2018-01-20 13:40:57 +01:00
parent e0b80a0929
commit 942c426525
5 changed files with 219 additions and 28 deletions

View file

@ -16,7 +16,7 @@
' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
'
Option Explicit
OPTION EXPLICIT : : DIM W
dim x, y, z
Dim obj
@ -53,6 +53,9 @@ Call ok(false = 0, "false <> 0")
Call ok(&hff = 255, "&hff <> 255")
Call ok(&Hff = 255, "&Hff <> 255")
W = 5
Call ok(W = 5, "W = " & W & " expected " & 5)
x = "xx"
Call ok(x = "xx", "x = " & x & " expected ""xx""")
@ -330,6 +333,13 @@ WHILE x < 3 : x = x + 1
Wend
Call ok(x = 3, "x not equal to 3")
z = 2
while z > -4 :
z = z -2
wend
x = false
y = false
do while not (x and y)
@ -353,6 +363,12 @@ Do While x < 2 : x = x + 1
Loop
Call ok(x = 2, "x not equal to 2")
x = 0
Do While x >= -2 :
x = x - 1
Loop
Call ok(x = -3, "x not equal to -3")
x = false
y = false
do until x and y
@ -376,6 +392,14 @@ Do: :: x = x + 2
Loop Until x = 4
Call ok(x = 4, "x not equal to 4")
x = 5
Do: :
: x = x * 2
Loop Until x = 40
Call ok(x = 40, "x not equal to 40")
x = false
do
if x then exit do
@ -495,6 +519,12 @@ for x = 1 to 100
Call ok(false, "exit for not escaped the loop?")
next
for x = 1 to 5 :
:
: :exit for
Call ok(false, "exit for not escaped the loop?")
next
do while true
for x = 1 to 100
exit do
@ -507,6 +537,14 @@ while null
call ok(false, "while null evaluated")
wend
Call collectionObj.reset()
y = 0
for each x in collectionObj :
:y = y + 3
next
Call ok(y = 9, "y = " & y)
Call collectionObj.reset()
y = 0
x = 10
@ -611,6 +649,21 @@ select case 2: case 5,6,7: Call ok(false, "unexpected case")
end select
Call ok(x, "wrong case")
x = False
select case 1 :
:case 3, 4 :
case 5
:
Call ok(false, "unexpected case") :
Case Else:
x = True
end select
Call ok(x, "wrong case")
if false then
Sub testsub
x = true
@ -699,6 +752,11 @@ Private Sub TestPrivateSub
End Sub
Call TestPrivateSub
Public Sub TestSeparatorSub : :
:
End Sub
Call TestSeparatorSub
if false then
Function testfunc
x = true
@ -814,6 +872,12 @@ Private Function TestPrivateFunc
End Function
Call TestPrivateFunc
Public Function TestSepFunc(ByVal a) : :
: TestSepFunc = a
End Function
Call ok(TestSepFunc(1) = 1, "Function did not return 1")
' Stop has an effect only in debugging mode
Stop
@ -1074,6 +1138,30 @@ Class Property2
End Sub
End Class
Class SeparatorTest : : Dim varTest1
:
Private Sub Class_Initialize : varTest1 = 1
End Sub ::
Property Get Test1() :
Test1 = varTest1
End Property ::
: :
Property Let Test1(a) :
varTest1 = a
End Property :
Public Function AddToTest1(ByVal a) :: :
varTest1 = varTest1 + a
AddToTest1 = varTest1
End Function : End Class : :: Set obj = New SeparatorTest
Call ok(obj.Test1 = 1, "obj.Test1 is not 1")
obj.Test1 = 6
Call ok(obj.Test1 = 6, "obj.Test1 is not 6")
obj.AddToTest1(5)
Call ok(obj.Test1 = 11, "obj.Test1 is not 11")
' Array tests
Call ok(getVT(arr) = "VT_EMPTY*", "getVT(arr) = " & getVT(arr))
@ -1107,6 +1195,8 @@ arr3(3,2,1) = 1
arr3(1,2,3) = 2
Call ok(arr3(3,2,1) = 1, "arr3(3,2,1) = " & arr3(3,2,1))
Call ok(arr3(1,2,3) = 2, "arr3(1,2,3) = " & arr3(1,2,3))
arr2(4,3) = 1
Call ok(arr2(4,3) = 1, "arr2(4,3) = " & arr2(4,3))
x = arr3
Call ok(x(3,2,1) = 1, "x(3,2,1) = " & x(3,2,1))
@ -1200,6 +1290,49 @@ Call testarrarg(1, "VT_I2*")
Call testarrarg(false, "VT_BOOL*")
Call testarrarg(Empty, "VT_EMPTY*")
Sub modifyarr(arr)
'Following test crashes on wine
'Call ok(arr(0) = "not modified", "arr(0) = " & arr(0))
arr(0) = "modified"
End Sub
arr(0) = "not modified"
Call modifyarr(arr)
Call ok(arr(0) = "modified", "arr(0) = " & arr(0))
arr(0) = "not modified"
modifyarr(arr)
Call todo_wine_ok(arr(0) = "not modified", "arr(0) = " & arr(0))
for x = 0 to UBound(arr)
arr(x) = x
next
y = 0
for each x in arr
Call ok(x = y, "x = " & x & ", expected " & y)
Call ok(arr(y) = y, "arr(" & y & ") = " & arr(y))
arr(y) = 1
x = 1
y = y+1
next
Call ok(y = 4, "y = " & y & " after array enumeration")
for x=0 to UBound(arr2, 1)
for y=0 to UBound(arr2, 2)
arr2(x, y) = x + y*(UBound(arr2, 1)+1)
next
next
y = 0
for each x in arr2
Call ok(x = y, "x = " & x & ", expected " & y)
y = y+1
next
Call ok(y = 20, "y = " & y & " after array enumeration")
for each x in noarr
Call ok(false, "Empty array contains: " & x)
next
' It's allowed to declare non-builtin RegExp class...
class RegExp
public property get Global()