2 ' Copyright 2011 Jacek Caban for CodeWeavers
4 ' This library is free software; you can redistribute it and/or
5 ' modify it under the terms of the GNU Lesser General Public
6 ' License as published by the Free Software Foundation; either
7 ' version 2.1 of the License, or (at your option) any later version.
9 ' This library is distributed in the hope that it will be useful,
10 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ' Lesser General Public License for more details.
14 ' You should have received a copy of the GNU Lesser General Public
15 ' License along with this library; if not, write to the Free Software
16 ' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 OPTION EXPLICIT : : DIM W
24 call ok(true, "true is not true?")
25 ok
true, "true is not true?"
26 call ok((true), "true is not true?")
28 ok
not false, "not false but not true?"
29 ok
not not true, "not not true but not true?"
31 Call ok(true = true, "true = true is false")
32 Call ok(false = false, "false = false is false")
33 Call ok(not (true = false), "true = false is true")
34 Call ok("x" = "x", """x"" = ""x"" is false")
35 Call ok(empty
= empty
, "empty = empty is false")
36 Call ok(empty
= "", "empty = """" is false")
37 Call ok(0 = 0.0, "0 <> 0.0")
38 Call ok(16 = &h10
&, "16 <> &h10&")
39 Call ok(010 = 10, "010 <> 10")
40 Call ok(10. = 10, "10. <> 10")
41 Call ok(&hffFFffFF
& = -1, "&hffFFffFF& <> -1")
42 Call ok(&hffFFffFF
& = -1, "&hffFFffFF& <> -1")
43 Call ok(34e5
= 3400000, "34e5 <> 3400000")
44 Call ok(34e+5 = 3400000, "34e+5 <> 3400000")
45 Call ok(56.789e5
= 5678900, "56.789e5 = 5678900")
46 Call ok(56.789e-2 = 0.56789, "56.789e-2 <> 0.56789")
47 Call ok(1e-94938484 = 0, "1e-... <> 0")
48 Call ok(34e0
= 34, "34e0 <> 34")
49 Call ok(34E1
= 340, "34E0 <> 340")
50 Call ok(.5 = 0.5, ".5 <> 0.5")
51 Call ok(.5e1
= 5, ".5e1 <> 5")
52 Call ok(--1 = 1, "--1 = " & --1)
53 Call ok(-empty
= 0, "-empty = " & (-empty
))
54 Call ok(true = -1, "! true = -1")
55 Call ok(false = 0, "false <> 0")
56 Call ok(&hff
= 255, "&hff <> 255")
57 Call ok(&Hff
= 255, "&Hff <> 255")
58 Call ok(&hffff
= -1, "&hffff <> -1")
59 Call ok(&hfffe
= -2, "&hfffe <> -2")
60 Call ok(&hffff
& = 65535, "&hffff& <> -1")
61 Call ok(&hfffe
& = 65534, "&hfffe& <> -2")
62 Call ok(&hffffffff
& = -1, "&hffffffff& <> -1")
63 Call ok((&h01or
&h02
)=3,"&h01or&h02 <> 3")
66 Call ok(W
= 5, "W = " & W
& " expected " & 5)
69 Call ok(x
= "xx", "x = " & x
& " expected ""xx""")
71 Dim public1
: public1
= 42
72 Call ok(public1
= 42, "public1=" & public1
& " expected & " & 42)
73 Private priv1
: priv1
= 43
74 Call ok(priv1
= 43, "priv1=" & priv1
& " expected & " & 43)
75 Public pub1
: pub1
= 44
76 Call ok(pub1
= 44, "pub1=" & pub1
& " expected & " & 44)
78 Call ok(true <> false, "true <> false is false")
79 Call ok(not (true <> true), "true <> true is true")
80 Call ok(not ("x" <> "x"), """x"" <> ""x"" is true")
81 Call ok(not (empty
<> empty
), "empty <> empty is true")
82 Call ok(x
<> "x", "x = ""x""")
83 Call ok("true" <> true, """true"" = true is true")
85 Call ok("" = true = false, """"" = true = false is false")
86 Call ok(not(false = true = ""), "false = true = """" is true")
87 Call ok(not (false = false <> false = false), "false = false <> false = false is true")
88 Call ok(not ("" <> false = false), """"" <> false = false is true")
90 Call ok(getVT(false) = "VT_BOOL", "getVT(false) is not VT_BOOL")
91 Call ok(getVT(true) = "VT_BOOL", "getVT(true) is not VT_BOOL")
92 Call ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR")
93 Call ok(getVT("test") = "VT_BSTR", "getVT(""test"") is not VT_BSTR")
94 Call ok(getVT(Empty
) = "VT_EMPTY", "getVT(Empty) is not VT_EMPTY")
95 Call ok(getVT(null
) = "VT_NULL", "getVT(null) is not VT_NULL")
96 Call ok(getVT(0) = "VT_I2", "getVT(0) is not VT_I2")
97 Call ok(getVT(1) = "VT_I2", "getVT(1) is not VT_I2")
98 Call ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8")
99 Call ok(getVT(.5) = "VT_R8", "getVT(.5) is not VT_R8")
100 Call ok(getVT(0.0) = "VT_R8", "getVT(0.0) is not VT_R8")
101 Call ok(getVT(2147483647) = "VT_I4", "getVT(2147483647) is not VT_I4")
102 Call ok(getVT(2147483648) = "VT_R8", "getVT(2147483648) is not VT_R8")
103 Call ok(getVT(&h10
&) = "VT_I2", "getVT(&h10&) is not VT_I2")
104 Call ok(getVT(&h10000
&) = "VT_I4", "getVT(&h10000&) is not VT_I4")
105 Call ok(getVT(&H10000
&) = "VT_I4", "getVT(&H10000&) is not VT_I4")
106 Call ok(getVT(&hffFFffFF
&) = "VT_I2", "getVT(&hffFFffFF&) is not VT_I2")
107 Call ok(getVT(&hffFFffFE
&) = "VT_I2", "getVT(&hffFFffFE &) is not VT_I2")
108 Call ok(getVT(&hffF
&) = "VT_I2", "getVT(&hffFF&) is not VT_I2")
109 Call ok(getVT(&hffFF
&) = "VT_I4", "getVT(&hffFF&) is not VT_I4")
110 Call ok(getVT(1e2
) = "VT_R8", "getVT(1e2) is not VT_R8")
111 Call ok(getVT(1e0
) = "VT_R8", "getVT(1e0) is not VT_R8")
112 Call ok(getVT(0.1e2
) = "VT_R8", "getVT(0.1e2) is not VT_R8")
113 Call ok(getVT(1 & 100000) = "VT_BSTR", "getVT(1 & 100000) is not VT_BSTR")
114 Call ok(getVT(-empty
) = "VT_I2", "getVT(-empty) = " & getVT(-empty
))
115 Call ok(getVT(-null
) = "VT_NULL", "getVT(-null) = " & getVT(-null
))
116 Call ok(getVT(y
) = "VT_EMPTY*", "getVT(y) = " & getVT(y
))
117 Call ok(getVT(nothing) = "VT_DISPATCH", "getVT(nothing) = " & getVT(nothing))
119 Call ok(getVT(x
) = "VT_DISPATCH*", "getVT(x=nothing) = " & getVT(x
))
121 Call ok(getVT(x
) = "VT_BOOL*", "getVT(x) = " & getVT(x
))
122 Call ok(getVT(false or true) = "VT_BOOL", "getVT(false) is not VT_BOOL")
124 Call ok(getVT(x
) = "VT_BSTR*", "getVT(x) is not VT_BSTR*")
126 Call ok(getVT(x
) = "VT_R8*", "getVT(x) = " & getVT(x
))
128 Call ok(isNullDisp(nothing), "nothing is not nulldisp?")
131 Call ok("ab" & "cd" = "abcd", """ab"" & ""cd"" <> ""abcd""")
132 Call ok("ab " & null
= "ab ", """ab"" & null = " & ("ab " & null
))
133 Call ok("ab " & empty
= "ab ", """ab"" & empty = " & ("ab " & empty
))
134 Call ok(1 & 100000 = "1100000", "1 & 100000 = " & (1 & 100000))
135 Call ok("ab" & x
= "abxx", """ab"" & x = " & ("ab"&x
))
137 if(isEnglishLang
) then
138 Call ok("" & true = "True", """"" & true = " & true)
139 Call ok(true & false = "TrueFalse", "true & false = " & (true & false))
142 call ok(true and true, "true and true is not true")
143 call ok(true and not false, "true and not false is not true")
144 call ok(not (false and true), "not (false and true) is not true")
145 call ok(getVT(null
and true) = "VT_NULL", "getVT(null and true) = " & getVT(null
and true))
147 call ok(false or true, "false or uie is false?")
148 call ok(not (false or false), "false or false is not false?")
149 call ok(false and false or true, "false and false or true is false?")
150 call ok(true or false and false, "true or false and false is false?")
151 call ok(null
or true, "null or true is false")
153 call ok(true xor
false, "true xor false is false?")
154 call ok(not (false xor
false), "false xor false is true?")
155 call ok(not (true or false xor
true), "true or false xor true is true?")
156 call ok(not (true xor
false or true), "true xor false or true is true?")
158 call ok(false eqv
false, "false does not equal false?")
159 call ok(not (false eqv
true), "false equals true?")
160 call ok(getVT(false eqv null
) = "VT_NULL", "getVT(false eqv null) = " & getVT(false eqv null
))
162 call ok(true imp
true, "true does not imp true?")
163 call ok(false imp
false, "false does not imp false?")
164 call ok(not (true imp
false), "true imp false?")
165 call ok(false imp null
, "false imp null is false?")
167 Call ok(2 >= 1, "! 2 >= 1")
168 Call ok(2 >= 2, "! 2 >= 2")
169 Call ok(not(true >= 2), "true >= 2 ?")
170 Call ok(2 > 1, "! 2 > 1")
171 Call ok(false > true, "! false < true")
172 Call ok(0 > true, "! 0 > true")
173 Call ok(not (true > 0), "true > 0")
174 Call ok(not (0 > 1 = 1), "0 > 1 = 1")
175 Call ok(1 < 2, "! 1 < 2")
176 Call ok(1 = 1 < 0, "! 1 = 1 < 0")
177 Call ok(1 <= 2, "! 1 <= 2")
178 Call ok(2 <= 2, "! 2 <= 2")
180 Call ok(isNull(0 = null
), "'(0 = null)' is not null")
181 Call ok(isNull(null
= 1), "'(null = 1)' is not null")
182 Call ok(isNull(0 > null
), "'(0 > null)' is not null")
183 Call ok(isNull(null
> 1), "'(null > 1)' is not null")
184 Call ok(isNull(0 < null
), "'(0 < null)' is not null")
185 Call ok(isNull(null
< 1), "'(null < 1)' is not null")
186 Call ok(isNull(0 <> null
), "'(0 <> null)' is not null")
187 Call ok(isNull(null
<> 1), "'(null <> 1)' is not null")
188 Call ok(isNull(0 >= null
), "'(0 >= null)' is not null")
189 Call ok(isNull(null
>= 1), "'(null >= 1)' is not null")
190 Call ok(isNull(0 <= null
), "'(0 <= null)' is not null")
191 Call ok(isNull(null
<= 1), "'(null <= 1)' is not null")
194 Call ok(2+2 = 4, "2+2 = " & (2+2))
195 Call ok(false + 6 + true = 5, "false + 6 + true <> 5")
196 Call ok(getVT(2+null
) = "VT_NULL", "getVT(2+null) = " & getVT(2+null
))
197 Call ok(2+empty
= 2, "2+empty = " & (2+empty
))
198 Call ok(x
+x
= 6, "x+x = " & (x
+x
))
200 Call ok(5-1 = 4, "5-1 = " & (5-1))
201 Call ok(3+5-true = 9, "3+5-true <> 9")
202 Call ok(getVT(2-null
) = "VT_NULL", "getVT(2-null) = " & getVT(2-null
))
203 Call ok(2-empty
= 2, "2-empty = " & (2-empty
))
204 Call ok(2-x
= -1, "2-x = " & (2-x
))
206 Call ok(9 Mod
6 = 3, "9 Mod 6 = " & (9 Mod
6))
207 Call ok(11.6 Mod
5.5 = False, "11.6 Mod 5.5 = " & (11.6 Mod
5.5 = 0.6))
208 Call ok(7 Mod
4+2 = 5, "7 Mod 4+2 <> 5")
209 Call ok(getVT(2 mod null
) = "VT_NULL", "getVT(2 mod null) = " & getVT(2 mod null
))
210 Call ok(getVT(null mod
2) = "VT_NULL", "getVT(null mod 2) = " & getVT(null mod
2))
211 'FIXME: Call ok(empty mod 2 = 0, "empty mod 2 = " & (empty mod 2))
213 Call ok(5 \
2 = 2, "5 \ 2 = " & (5\
2))
214 Call ok(4.6 \
1.5 = 2, "4.6 \ 1.5 = " & (4.6\
1.5))
215 Call ok(4.6 \
1.49 = 5, "4.6 \ 1.49 = " & (4.6\
1.49))
216 Call ok(2+3\
4 = 2, "2+3\4 = " & (2+3\
4))
218 Call ok(2*3 = 6, "2*3 = " & (2*3))
219 Call ok(3/2 = 1.5, "3/2 = " & (3/2))
220 Call ok(5\
4/2 = 2, "5\4/2 = " & (5\
2/1))
221 Call ok(12/3\
2 = 2, "12/3\2 = " & (12/3\
2))
222 Call ok(5/1000000 = 0.000005, "5/1000000 = " & (5/1000000))
224 Call ok(2^
3 = 8, "2^3 = " & (2^
3))
225 Call ok(2^
3^
2 = 64, "2^3^2 = " & (2^
3^
2))
226 Call ok(-3^
2 = 9, "-3^2 = " & (-3^
2))
227 Call ok(2*3^
2 = 18, "2*3^2 = " & (2*3^
2))
236 if true then y
= true : x
= y
239 x
= true : if false then x
= false
240 ok x
, "x is false, if false called?"
242 if not false then x
= true
243 ok x
, "x is false, if not false not called?"
245 if not false then x
= "test" : x
= true
246 ok x
, "x is false, if not false not called?"
248 if false then x
= y
: call ok(false, "if false .. : called")
250 if false then x
= y
: call ok(false, "if false .. : called") else x
= "else"
251 Call ok(x
= "else", "else not called?")
253 if true then x
= y
else y
= x
: Call ok(false, "in else?")
257 if false then x
= y
: if true then call ok(false, "embedded if called")
259 if false then x
=1 else x
=2 end if
260 if true then x
=1 end if
263 if false then x
= true : x
= true
264 Call ok(x
= false, "x <> false")
267 ok
false, "if false called"
274 Call ok(not x
, "x is false, if not evaluated?")
278 Call ok(false, "inside if false")
282 Call ok(x
, "else not called?")
286 Call ok(false, "inside if false")
288 Call ok(false, "inside elseif not true")
292 Call ok(x
, "else not called?")
296 Call ok(false, "inside if false")
299 ElseIf not False Then
302 Call ok(false, "inside else not true")
304 Call ok(x
, "elseif not called?")
308 Call ok(false, "inside if false")
309 ElseIf not False Then
312 Call ok(x
, "elseif not called?")
316 Call ok(x
, "if 1 not run?")
319 if &h10000
& then x
= true
320 Call ok(x
, "if &h10000& not run?")
330 call ok((x
and y
), "x or y is false after while")
352 ok
false, "if empty executed"
356 ok
false, "while empty executed"
360 WHILE x
< 3 : x
= x
+ 1 : Wend
361 Call ok(x
= 3, "x not equal to 3")
364 WHILE x
< 3 : x
= x
+ 1
366 Call ok(x
= 3, "x not equal to 3")
377 do while not (x
and y
)
383 call ok((x
and y
), "x or y is false after while")
388 do while false : loop
392 ok
false, "exit do didn't work"
396 Do While x
< 2 : x
= x
+ 1
398 Call ok(x
= 2, "x not equal to 2")
401 Do While x
< 2 : x
= x
+ 1: Loop
402 Call ok(x
= 2, "x not equal to 2")
408 Call ok(x
= -3, "x not equal to -3")
418 call ok((x
and y
), "x or y is false after do until")
425 ok
false, "exit do didn't work"
431 Call ok(x
= 4, "x not equal to 4")
434 Do: :: x
= x
+ 2 ::: : Loop Until x
= 4
435 Call ok(x
= 4, "x not equal to 4")
442 Call ok(x
= 40, "x not equal to 40")
450 call ok(x
, "x is false after do..loop?")
458 Call ok(x
= 6, "x not equal to 6")
468 call ok((x
and y
), "x or y is false after while")
475 ok
false, "exit do didn't work"
485 loop while not (x
and y
)
486 call ok((x
and y
), "x or y is false after while")
493 ok
false, "exit do didn't work"
500 Call ok(y
= "for1: 5 6 7 8", "y = " & y
)
503 for x
= 5 to 8 step
2
506 Call ok(y
= "for2: 5 7", "y = " & y
)
513 Call ok(y
= "for3: 5 6 7 8", "y = " & y
)
519 Call ok(y
= "for4:", "y = " & y
)
522 for x
= 5 to 3 step
true
525 Call ok(y
= "for5: 5 4 3", "y = " & y
)
529 for x
= 5 to z step
3-4
533 Call ok(y
= "for6: 5 4", "y = " & y
)
537 for x
= 5 to 8 step z
541 Call ok(y
= "for7: 5 6 7 8", "y = " & y
)
544 For x
= 10 To 18 Step
2 : : z
= z
+ 1
546 Call ok(z
= 5, "z not equal to 5")
553 Call ok(y
= "for8: 5 7", "y = " & y
)
556 Call ok(false, "for..to called when unexpected")
561 Call ok(false, "exit for not escaped the loop?")
567 Call ok(false, "exit for not escaped the loop?")
572 for x
=1 to 8:a1(x
)=x
-1:next
573 Call ok(a1(6) = 5, "colon used in for loop")
578 Call ok(a1(6) = 4, "colon used in for loop")
586 if null
then call ok(false, "if null evaluated")
589 call ok(false, "while null evaluated")
592 Call collectionObj
.reset()
594 for each x
in collectionObj
:
598 Call ok(y
= 9, "y = " & y
)
600 Call collectionObj
.reset()
604 for each x
in collectionObj
: z
= z
+ 2
606 Call ok(x
= y
, "x <> y")
608 Call ok(y
= 3, "y = " & y
)
609 Call ok(z
= 6, "z = " & z
)
610 Call ok(getVT(x
) = "VT_EMPTY*", "getVT(x) = " & getVT(x
))
612 Call collectionObj
.reset()
616 for each x
in collectionObj
: z
= z
+ 2 : y
= y
+1 ::
617 Call ok(x
= y
, "x <> y") : next
618 Call ok(y
= 3, "y = " & y
)
619 Call ok(z
= 6, "z = " & z
)
621 Call collectionObj
.reset()
623 for each x
in collectionObj
624 if x
= 2 then exit for
627 Call ok(y
= 1, "y = " & y
)
628 Call ok(x
= 2, "x = " & x
)
630 Set obj
= collectionObj
636 Call ok(x
= y
, "x <> y")
638 Call ok(y
= 3, "y = " & y
)
639 Call ok(getVT(x
) = "VT_EMPTY*", "getVT(x) = " & getVT(x
))
644 Call ok(false, "unexpected case")
646 Call ok(false, "unexpected case")
648 Call ok(false, "unexpected case")
651 Call ok(false, "unexpected case")
652 case 0, false, 2+1, 10
654 case ok(false, "unexpected case")
655 Call ok(false, "unexpected case")
657 Call ok(false, "unexpected case")
659 Call ok(x
, "wrong case")
666 Call ok(x
, "wrong case")
671 Call ok(false, "unexpected case")
675 Call ok(x
, "wrong case")
683 Call ok(false, "unexpected case")
685 Call ok(x
, "wrong case")
689 Call ok(false, "unexpected case")
691 Call ok(false, "unexpected case")
699 case 3,1,2,4: x
= true
701 Call ok(false, "unexpected case")
703 Call ok(x
, "wrong case")
706 select case 2: case 5,6,7: Call ok(false, "unexpected case")
709 case else: Call ok(false, "unexpected case else")
711 Call ok(x
, "wrong case")
721 Call ok(false, "unexpected case") :
726 Call ok(x
, "wrong case")
731 'empty else with comment test
734 select case 0 : case 1 : case else : end select
744 Call ok(x
, "x is false, testsub not called?")
747 Call ok(not v
, "v is not true")
753 Call ok(x
, "x was not set by SubSetTrue")
756 Call ok(not false, "false is no longer false?")
758 Sub SubSetTrue2(ByRef v
)
759 Call ok(not v
, "v is not true")
765 Call ok(x
, "x was not set by SubSetTrue")
767 Sub TestSubArgVal(ByVal v
)
768 Call ok(not v
, "v is not false")
770 Call ok(v
, "v is not true?")
774 Call TestSubArgVal(x
)
775 Call ok(not x
, "x is true after TestSubArgVal call?")
777 Sub TestSubMultiArgs(a
,b
,c
,d
,e
)
778 Call ok(a
=1, "a = " & a
)
779 Call ok(b
=2, "b = " & b
)
780 Call ok(c
=3, "c = " & c
)
781 Call ok(d
=4, "d = " & d
)
782 Call ok(e
=5, "e = " & e
)
785 Sub TestSubExit(ByRef a
)
789 Call ok(false, "Exit Sub not called?")
792 Call TestSubExit(true)
801 TestSubMultiArgs
1, 2, 3, 4, 5
802 Call TestSubMultiArgs(1, 2, 3, 4, 5)
806 Call ok(not x
, "local x is not false?")
814 Call ok(x
, "global x is not true?")
816 Public Sub TestPublicSub
820 Private Sub TestPrivateSub
824 Public Sub TestSeparatorSub
: :
827 Call TestSeparatorSub
837 Call ok(x
, "x is false, testfunc not called?")
839 Function FuncSetTrue(v
)
840 Call ok(not v
, "v is not true")
846 Call ok(x
, "x was not set by FuncSetTrue")
849 Call ok(not false, "false is no longer false?")
851 Function FuncSetTrue2(ByRef v
)
852 Call ok(not v
, "v is not true")
858 Call ok(x
, "x was not set by FuncSetTrue")
860 Function TestFuncArgVal(ByVal v
)
861 Call ok(not v
, "v is not false")
863 Call ok(v
, "v is not true?")
867 Call TestFuncArgVal(x
)
868 Call ok(not x
, "x is true after TestFuncArgVal call?")
870 Function TestFuncMultiArgs(a
,b
,c
,d
,e
)
871 Call ok(a
=1, "a = " & a
)
872 Call ok(b
=2, "b = " & b
)
873 Call ok(c
=3, "c = " & c
)
874 Call ok(d
=4, "d = " & d
)
875 Call ok(e
=5, "e = " & e
)
878 TestFuncMultiArgs
1, 2, 3, 4, 5
879 Call TestFuncMultiArgs(1, 2, 3, 4, 5)
881 Function TestFuncLocalVal
883 Call ok(not x
, "local x is not false?")
889 Call TestFuncLocalVal
890 Call ok(x
, "global x is not true?")
892 Function TestFuncExit(ByRef a
)
896 Call ok(false, "Exit Function not called?")
899 Call TestFuncExit(true)
901 Function TestFuncExit2(ByRef a
)
907 Call ok(false, "Exit Function not called?")
910 Call TestFuncExit2(true)
916 Function FuncParseTest
917 End Function : x
= false
924 Call ok(ReturnTrue(), "ReturnTrue returned false?")
926 Function SetVal(ByRef x
, ByVal v
)
933 ok
SetVal(x
, true), "SetVal returned false?"
934 Call ok(x
, "x is not set to true by SetVal?")
936 Public Function TestPublicFunc
940 Private Function TestPrivateFunc
944 Public Function TestSepFunc(ByVal a
) : :
947 Call ok(TestSepFunc(1) = 1, "Function did not return 1")
949 ok
duplicatedfunc() = 2, "duplicatedfunc = " & duplicatedfunc()
951 function duplicatedfunc
952 ok
false, "duplicatedfunc called"
956 ok
false, "duplicatedfunc called"
959 function duplicatedfunc
963 ok
duplicatedfunc() = 2, "duplicatedfunc = " & duplicatedfunc()
965 ' Stop has an effect only in debugging mode
969 Call ok(getVT(x
) = "VT_DISPATCH*", "getVT(x=testObj) = " & getVT(x
))
971 Set obj
= New EmptyClass
972 Call ok(getVT(obj
) = "VT_DISPATCH*", "getVT(obj) = " & getVT(obj
))
978 Call ok(getVT(x
) = "VT_DISPATCH*", "getVT(x) = " & getVT(x
))
985 Public Function publicFunction()
990 Public Property Get gsProp()
992 funcCalled
= "gsProp get"
994 Call ok(false, "exit property not returned?")
997 Public Default
Property Get DefValGet
998 DefValGet
= privateProp
999 funcCalled
= "GetDefVal"
1002 Public Property Let DefValGet(x
)
1007 Public Sub publicSub
1010 Public Property Let gsProp(val
)
1012 funcCalled
= "gsProp let"
1014 Call ok(false, "exit property not returned?")
1017 Public Property Set gsProp(val
)
1018 funcCalled
= "gsProp set"
1020 Call ok(false, "exit property not returned?")
1023 Public Sub setPrivateProp(x
)
1027 Function getPrivateProp
1028 getPrivateProp
= privateProp
1031 Private Sub privateSub
1034 Public Sub Class_Initialize
1037 Call ok(getVT(privateProp
) = "VT_BOOL*", "getVT(privateProp) = " & getVT(privateProp
))
1038 Call ok(getVT(publicProp2
) = "VT_I2*", "getVT(publicProp2) = " & getVT(publicProp2
))
1039 Call ok(getVT(Me.publicProp2
) = "VT_I2", "getVT(Me.publicProp2) = " & getVT(Me.publicProp2
))
1042 Property Get gsGetProp(x
)
1047 Call testDisp(new testClass
)
1049 Set obj
= New TestClass
1051 Call ok(obj
.publicFunction
= 4, "obj.publicFunction = " & obj
.publicFunction
)
1052 Call ok(obj
.publicFunction() = 4, "obj.publicFunction() = " & obj
.publicFunction())
1056 Call obj
.publicFunction()
1058 Call ok(getVT(obj
.publicProp
) = "VT_EMPTY", "getVT(obj.publicProp) = " & getVT(obj
.publicProp
))
1060 Call ok(getVT(obj
.publicProp
) = "VT_I2", "getVT(obj.publicProp) = " & getVT(obj
.publicProp
))
1061 Call ok(obj
.publicProp
= 3, "obj.publicProp = " & obj
.publicProp
)
1062 obj
.publicProp() = 3
1064 Call ok(obj
.getPrivateProp() = true, "obj.getPrivateProp() = " & obj
.getPrivateProp())
1065 Call obj
.setPrivateProp(6)
1066 Call ok(obj
.getPrivateProp
= 6, "obj.getPrivateProp = " & obj
.getPrivateProp
)
1070 Call ok(obj
.gsProp
= 6, "obj.gsProp = " & obj
.gsProp
)
1071 Call ok(funcCalled
= "gsProp get", "funcCalled = " & funcCalled
)
1073 Call ok(funcCalled
= "gsProp let", "funcCalled = " & funcCalled
)
1074 Call ok(obj
.getPrivateProp
= 3, "obj.getPrivateProp = " & obj
.getPrivateProp
)
1075 Set obj
.gsProp
= New testclass
1076 Call ok(funcCalled
= "gsProp set", "funcCalled = " & funcCalled
)
1079 Call ok(x
= 3, "(x = obj) = " & x
)
1080 Call ok(funcCalled
= "GetDefVal", "funcCalled = " & funcCalled
)
1082 Call ok(obj
= 3, "(x = obj) = " & obj
)
1083 Call ok(funcCalled
= "GetDefVal", "funcCalled = " & funcCalled
)
1085 Call obj
.Class_Initialize
1086 Call ok(obj
.getPrivateProp() = true, "obj.getPrivateProp() = " & obj
.getPrivateProp())
1088 x
= (New testclass
).publicProp
1091 Public Sub Class_Terminate()
1092 funcCalled
= "terminate"
1096 Set obj
= New TermTest
1099 Call ok(funcCalled
= "terminate", "funcCalled = " & funcCalled
)
1101 Set obj
= New TermTest
1103 Call obj
.Class_Terminate
1104 Call ok(funcCalled
= "terminate", "funcCalled = " & funcCalled
)
1107 Call ok(funcCalled
= "terminate", "funcCalled = " & funcCalled
)
1109 Call (New testclass
).publicSub()
1110 Call (New testclass
).publicSub
1113 property get prop0()
1117 property get prop1(x
)
1121 property get prop2(x
, y
)
1126 set obj
= new PropTest
1128 call ok(obj
.prop0
= 1, "obj.prop0 = " & obj
.prop0
)
1129 call ok(obj
.prop1(3) = 4, "obj.prop1(3) = " & obj
.prop1(3))
1130 call ok(obj
.prop2(3,4) = 7, "obj.prop2(3,4) = " & obj
.prop2(3,4))
1135 x
= "following ':' is correct syntax" :
1136 x
= "following ':' is correct syntax" :: :
1137 :: x
= "also correct syntax"
1138 rem another ugly way for comments
1139 x
= "rem as simplestatement" : rem rem comment
1142 Set obj
= new EmptyClass
1144 Set y
= new EmptyClass
1146 Call ok(obj is x
, "obj is not x")
1147 Call ok(x is obj
, "x is not obj")
1148 Call ok(not (obj is y
), "obj is not y")
1149 Call ok(not obj is y
, "obj is not y")
1150 Call ok(not (x is
Nothing), "x is 1")
1151 Call ok(Nothing is
Nothing, "Nothing is not Nothing")
1152 Call ok(x is obj
and true, "x is obj and true is false")
1155 Public Sub Test(MyMe
)
1156 Call ok(Me is MyMe
, "Me is not MyMe")
1160 Set obj
= New TestMe
1163 Call ok(getVT(test
) = "VT_DISPATCH", "getVT(test) = " & getVT(test
))
1164 Call ok(Me is Test
, "Me is not Test")
1166 Const c1
= 1, c2
= 2, c3
= -3
1167 Call ok(c1
= 1, "c1 = " & c1
)
1168 Call ok(getVT(c1
) = "VT_I2", "getVT(c1) = " & getVT(c1
))
1169 Call ok(c3
= -3, "c3 = " & c3
)
1170 Call ok(getVT(c3
) = "VT_I2", "getVT(c3) = " & getVT(c3
))
1172 Const cb
= True, cs
= "test", cnull
= null
1173 Call ok(cb
, "cb = " & cb
)
1174 Call ok(getVT(cb
) = "VT_BOOL", "getVT(cb) = " & getVT(cb
))
1175 Call ok(cs
= "test", "cs = " & cs
)
1176 Call ok(getVT(cs
) = "VT_BSTR", "getVT(cs) = " & getVT(cs
))
1177 Call ok(isNull(cnull
), "cnull = " & cnull
)
1178 Call ok(getVT(cnull
) = "VT_NULL", "getVT(cnull) = " & getVT(cnull
))
1180 Call ok(+1 = 1, "+1 != 1")
1181 Call ok(+true = true, "+1 != 1")
1182 Call ok(getVT(+true) = "VT_BOOL", "getVT(+true) = " & getVT(+true))
1183 Call ok(+"true" = "true", """+true"" != true")
1184 Call ok(getVT(+"true") = "VT_BSTR", "getVT(+""true"") = " & getVT(+"true"))
1185 Call ok(+obj is obj
, "+obj != obj")
1186 Call ok(+--+-+1 = -1, "+--+-+1 != -1")
1188 if false then Const conststr
= "str"
1189 Call ok(conststr
= "str", "conststr = " & conststr
)
1190 Call ok(getVT(conststr
) = "VT_BSTR", "getVT(conststr) = " & getVT(conststr
))
1191 Call ok(conststr
= "str", "conststr = " & conststr
)
1195 Call ok(c1
= 1, "c1 = " & c1
)
1196 Call ok(funcconst
= 1, "funcconst = " & funcconst
)
1202 ' Property may be used as an identifier (although it's a keyword)
1206 Call ok(property, "property = " & property)
1208 for property = 1 to 2
1215 Public Sub Property()
1218 Sub Test(byref property)
1229 Sub Test2(byval property)
1233 Class SeparatorTest
: : Dim varTest1
1235 Private Sub Class_Initialize
: varTest1
= 1
1238 Property Get Test1() :
1242 Property Let Test1(a
) :
1246 Public Function AddToTest1(ByVal a
) :: :
1247 varTest1
= varTest1
+ a
1248 AddToTest1
= varTest1
1249 End Function : End Class
: :: Set obj
= New SeparatorTest
1251 Call ok(obj
.Test1
= 1, "obj.Test1 is not 1")
1253 Call ok(obj
.Test1
= 6, "obj.Test1 is not 6")
1255 Call ok(obj
.Test1
= 11, "obj.Test1 is not 11")
1259 call ok(getVT(obj
) = "VT_UNKNOWN*", "getVT(obj) = " & getVT(obj
))
1260 call ok(getVT(x
) = "VT_UNKNOWN*", "getVT(x) = " & getVT(x
))
1261 call ok(getVT(unkObj
) = "VT_UNKNOWN", "getVT(unkObj) = " & getVT(unkObj
))
1262 call ok(obj is unkObj
, "obj is not unkObj")
1266 Call ok(getVT(arr
) = "VT_EMPTY*", "getVT(arr) = " & getVT(arr
))
1269 Dim arr2(4,3), arr3(5,4,3), arr0(0), noarr()
1271 Call ok(getVT(arr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr) = " & getVT(arr
))
1272 Call ok(getVT(arr2
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr2) = " & getVT(arr2
))
1273 Call ok(getVT(arr0
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr0) = " & getVT(arr0
))
1274 Call ok(getVT(noarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(noarr) = " & getVT(noarr
))
1276 Call testArray(1, arr
)
1277 Call testArray(2, arr2
)
1278 Call testArray(3, arr3
)
1279 Call testArray(0, arr0
)
1280 Call testArray(-1, noarr
)
1282 Call ok(getVT(arr(1)) = "VT_EMPTY*", "getVT(arr(1)) = " & getVT(arr(1)))
1283 Call ok(getVT(arr2(1,2)) = "VT_EMPTY*", "getVT(arr2(1,2)) = " & getVT(arr2(1,2)))
1284 Call ok(getVT(arr3(1,2,2)) = "VT_EMPTY*", "getVT(arr3(1,2,3)) = " & getVT(arr3(1,2,2)))
1285 Call ok(getVT(arr(0)) = "VT_EMPTY*", "getVT(arr(0)) = " & getVT(arr(0)))
1286 Call ok(getVT(arr(3)) = "VT_EMPTY*", "getVT(arr(3)) = " & getVT(arr(3)))
1287 Call ok(getVT(arr0(0)) = "VT_EMPTY*", "getVT(arr0(0)) = " & getVT(arr0(0)))
1290 Call ok(arr(2) = 3, "arr(2) = " & arr(2))
1291 Call ok(getVT(arr(2)) = "VT_I2*", "getVT(arr(2)) = " & getVT(arr(2)))
1295 Call ok(arr3(3,2,1) = 1, "arr3(3,2,1) = " & arr3(3,2,1))
1296 Call ok(arr3(1,2,3) = 2, "arr3(1,2,3) = " & arr3(1,2,3))
1298 Call ok(arr2(4,3) = 1, "arr2(4,3) = " & arr2(4,3))
1301 Call ok(x(3,2,1) = 1, "x(3,2,1) = " & x(3,2,1))
1311 Call ok(getVT(x
) = "VT_ARRAY|VT_VARIANT*", "getVT(x) = " & getVT(x
))
1312 Call ok(x(2) = 2, "x(2) = " & x(2))
1313 Call ok(getVT(x(3)) = "VT_EMPTY*", "getVT(x(3)) = " & getVT(x(3)))
1316 Call ok(x(1) = 1, "x(1) = " & x(1))
1318 Call ok(getVT(x(1)) = "VT_EMPTY*", "getVT(x(1)) = " & getVT(x(1)))
1319 Call ok(x(2) = 2, "x(2) = " & x(2))
1324 Call ok(y(1) = 1, "y(1) = " & y(1))
1329 Call ok(getVT(forarr(1)) = "VT_EMPTY*", "getVT(forarr(1)) = " & getVT(forarr(1)))
1331 Call ok(forarr(1) = x
, "forarr(1) = " & forarr(1))
1337 Call ok(forarr(x
) = 2, "forarr(x) = " & forarr(x
))
1340 ok
arr(1) = 1, "arr(1) = " & arr(1)
1345 ok
arr(1) = 2, "arr(1) = " & arr(1)
1348 ok
arr2(x
,y
) = 1, "arr2(x,y) = " & arr2(x
,y
)
1353 call accessArr2(1, 2)
1354 ok
arr2(1,2) = 2, "arr2(1,2) = " & arr2(1,2)
1357 call ok(x(0)(0) = 3, "x(0)(0) = " & x(0)(0))
1366 ok
x(0) = 2, "x(0) = " & x(0)
1370 ok
x(0) = 1, "x(0) = " & x(0)
1373 call (((seta0
))) ((x
))
1374 ok
x(0) = 1, "x(0) = " & x(0)
1377 call (((seta0
))) (x
)
1378 ok
x(0) = 2, "x(0) = " & x(0)
1382 call ok(x(0)(0) = 2, "x(0)(0) = " & x(0)(0))
1386 call ok(x(0)(0) = 3, "x(0)(0) = " & x(0)(0))
1389 ok y
= 1, "y = " & y
1392 ok y
= 2, "y = " & y
1400 ok
x(0) = 2, "x(0) = " & x(0)
1401 ok
getVT(x
) = "VT_ARRAY|VT_VARIANT*", "getVT(x) after redim = " & getVT(x
)
1405 ok
x(0) = 1, "x(0) = " & x(0)
1409 ok
ubound(x
) = 4, "ubound(x) = " & ubound(x
)
1410 ok
x(0) = empty
, "x(0) = " & x(0)
1414 ok
ubound(x
) = 3, "ubound(x) = " & ubound(x
)
1422 ok
ubound(x
) = 1, "ubound(x) = " & ubound(x
)
1423 ok
x(0) = 1, "x(0) = " & x(1)
1424 ok
x(1) = 2, "x(1) = " & x(1)
1427 ok
ubound(x
) = 2, "ubound(x) = " & ubound(x
)
1428 ok
x(0) = 1, "x(0) = " & x(0)
1429 ok
x(1) = 2, "x(1) = " & x(1)
1430 ok
x(2) = vbEmpty
, "x(2) = " & x(2)
1432 on error resume next
1433 redim preserve x(2,2)
1436 ok e
= 9, "e = " & e
' VBSE_OUT_OF_BOUNDS, cannot change cDims
1440 ok
lbound(x
) = 0, "lbound(x) = " & lbound(x
)
1441 ok
ubound(x
) = -1, "ubound(x) = " & ubound(x
)
1444 ok
ubound(x
) = 3, "ubound(x) = " & ubound(x
)
1445 ok
ubound(x
, 1) = 3, "ubound(x, 1) = " & ubound(x
, 1)
1446 ok
ubound(x
, 2) = 2, "ubound(x, 2) = " & ubound(x
, 2) & " expected 2"
1458 redim preserve x(1,1)
1459 ok
ubound(x
, 1) = 1, "ubound(x, 1) = " & ubound(x
, 1)
1460 ok
ubound(x
, 2) = 1, "ubound(x, 2) = " & ubound(x
, 2)
1461 ok
x(0,0) = 1.1, "x(0,0) = " & x(0,0)
1462 ok
x(0,1) = 1.2, "x(0,1) = " & x(0,1)
1463 ok
x(1,0) = 2.1, "x(1,0) = " & x(1,0)
1464 ok
x(1,1) = 2.2, "x(1,1) = " & x(1,1)
1466 redim preserve x(1,2)
1467 ok
ubound(x
, 1) = 1, "ubound(x, 1) = " & ubound(x
, 1)
1468 ok
ubound(x
, 2) = 2, "ubound(x, 2) = " & ubound(x
, 2)
1469 ok
x(0,0) = 1.1, "x(0,0) = " & x(0,0)
1470 ok
x(0,1) = 1.2, "x(0,1) = " & x(0,1)
1471 ok
x(1,0) = 2.1, "x(1,0) = " & x(1,0)
1472 ok
x(1,1) = 2.2, "x(1,1) = " & x(1,1)
1473 ok
x(0,2) = vbEmpty
, "x(0,2) = " & x(0,2)
1474 ok
x(1,2) = vbEmpty
, "x(1,2) = " & x(1,1)
1476 on error resume next
1477 redim preserve x(2,2)
1480 ok e
= 9, "e = " & e
' VBSE_OUT_OF_BOUNDS, can only change rightmost dimension
1483 on error resume next
1484 redim staticarray(3)
1487 todo_wine_ok e
= 10, "e = " & e
1494 Private Sub Class_Initialize
1495 Call ok(getVT(classarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(classarr) = " & getVT(classarr
))
1496 Call testArray(-1, classnoarr
)
1503 Public Sub testVarVT
1504 Call ok(getVT(var
) = "VT_ARRAY|VT_VARIANT*", "getVT(var) = " & getVT(var
))
1508 Set obj
= new ArrClass
1509 Call ok(getVT(obj
.classarr
) = "VT_ARRAY|VT_VARIANT", "getVT(obj.classarr) = " & getVT(obj
.classarr
))
1510 'todo_wine Call ok(obj.classarr(1) = 2, "obj.classarr(1) = " & obj.classarr(1))
1513 Call ok(getVT(obj
.var
) = "VT_ARRAY|VT_VARIANT", "getVT(obj.var) = " & getVT(obj
.var
))
1516 Sub arrarg(byref refarr
, byval valarr
, byref refarr2
, byval valarr2
)
1517 Call ok(getVT(refarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr
))
1518 Call ok(getVT(valarr
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr
))
1519 Call ok(getVT(refarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2
))
1520 Call ok(getVT(valarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2
))
1523 Call arrarg(arr
, arr
, obj
.classarr
, obj
.classarr
)
1525 Sub arrarg2(byref refarr(), byval valarr(), byref refarr2(), byval valarr2())
1526 Call ok(getVT(refarr
) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr
))
1527 Call ok(getVT(valarr
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr
))
1528 Call ok(getVT(refarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2
))
1529 Call ok(getVT(valarr2
) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2
))
1532 Call arrarg2(arr
, arr
, obj
.classarr
, obj
.classarr
)
1534 Sub testarrarg(arg(), vt
)
1535 Call ok(getVT(arg
) = vt
, "getVT() = " & getVT(arg
) & " expected " & vt
)
1538 Call testarrarg(1, "VT_I2*")
1539 Call testarrarg(false, "VT_BOOL*")
1540 Call testarrarg(Empty
, "VT_EMPTY*")
1543 Call ok(arr(0) = "not modified", "arr(0) = " & arr(0))
1547 arr(0) = "not modified"
1549 Call ok(arr(0) = "modified", "arr(0) = " & arr(0))
1551 arr(0) = "not modified"
1553 Call ok(arr(0) = "not modified", "arr(0) = " & arr(0))
1555 for x
= 0 to UBound(arr
)
1560 Call ok(x
= y
, "x = " & x
& ", expected " & y
)
1561 Call ok(arr(y
) = y
, "arr(" & y
& ") = " & arr(y
))
1566 Call ok(y
= 4, "y = " & y
& " after array enumeration")
1568 for x
=0 to UBound(arr2
, 1)
1569 for y
=0 to UBound(arr2
, 2)
1570 arr2(x
, y
) = x
+ y
*(UBound(arr2
, 1)+1)
1575 Call ok(x
= y
, "x = " & x
& ", expected " & y
)
1578 Call ok(y
= 20, "y = " & y
& " after array enumeration")
1581 Call ok(false, "Empty array contains: " & x
)
1584 ' It's allowed to declare non-builtin RegExp class...
1586 public property get Global()
1587 Call ok(false, "Global called")
1592 ' ...but there is no way to use it because builtin instance is always created
1594 Call ok(x
.Global = false, "x.Global = " & x
.Global)
1596 sub test_nothing_errors
1598 on error resume next
1603 call ok(err
.number
= 91, "err.number = " & err
.number
)
1604 call ok(x
= 1, "x = " & x
)
1608 call ok(err
.number
= 91, "err.number = " & err
.number
)
1609 call ok(x
= 1, "x = " & x
)
1613 call ok(err
.number
= 91, "err.number = " & err
.number
)
1614 call ok(x
= 1, "x = " & x
)
1616 call test_nothing_errors()
1618 sub test_identifiers
1619 ' test keywords that can also be a declared identifier
1622 Call ok(default
= "xx", "default = " & default
& " expected ""xx""")
1626 Call ok(error = "xx", "error = " & error & " expected ""xx""")
1630 Call ok(explicit = "xx", "explicit = " & explicit & " expected ""xx""")
1634 Call ok(step
= "xx", "step = " & step
& " expected ""xx""")
1638 Call ok(property = "xx", "property = " & property & " expected ""xx""")
1640 call test_identifiers()
1642 Class class_test_identifiers_as_function_name
1643 Sub Property ( par
)
1646 Function Error( par
)
1652 Function Explicit (par
)
1656 Sub Step ( default
)
1660 Class class_test_identifiers_as_property_name
1661 Public Property Get Property()
1664 Public Property Let Error(par
)
1668 Public Property Set Default(par
)
1673 sub test_dotIdentifiers
1674 ' test keywords that can also be an identifier after a dot
1675 Call ok(testObj
.rem = 10, "testObj.rem = " & testObj.rem & " expected 10")
1676 Call ok(testObj
.true = 10, "testObj.true = " & testObj
.true & " expected 10")
1677 Call ok(testObj
.false = 10, "testObj.false = " & testObj
.false & " expected 10")
1678 Call ok(testObj
.not = 10, "testObj.not = " & testObj
.not & " expected 10")
1679 Call ok(testObj
.and = 10, "testObj.and = " & testObj
.and & " expected 10")
1680 Call ok(testObj
.or = 10, "testObj.or = " & testObj
.or & " expected 10")
1681 Call ok(testObj
.xor
= 10, "testObj.xor = " & testObj
.xor
& " expected 10")
1682 Call ok(testObj
.eqv
= 10, "testObj.eqv = " & testObj
.eqv
& " expected 10")
1683 Call ok(testObj
.imp
= 10, "testObj.imp = " & testObj
.imp
& " expected 10")
1684 Call ok(testObj
.is
= 10, "testObj.is = " & testObj
.is
& " expected 10")
1685 Call ok(testObj
.mod
= 10, "testObj.mod = " & testObj
.mod
& " expected 10")
1686 Call ok(testObj
.call = 10, "testObj.call = " & testObj
.call & " expected 10")
1687 Call ok(testObj
.dim = 10, "testObj.dim = " & testObj
.dim & " expected 10")
1688 Call ok(testObj
.sub = 10, "testObj.sub = " & testObj
.sub & " expected 10")
1689 Call ok(testObj
.function = 10, "testObj.function = " & testObj
.function & " expected 10")
1690 Call ok(testObj
.get = 10, "testObj.get = " & testObj
.get & " expected 10")
1691 Call ok(testObj
.let = 10, "testObj.let = " & testObj
.let & " expected 10")
1692 Call ok(testObj
.const = 10, "testObj.const = " & testObj
.const & " expected 10")
1693 Call ok(testObj
.if = 10, "testObj.if = " & testObj
.if & " expected 10")
1694 Call ok(testObj
.else = 10, "testObj.else = " & testObj
.else & " expected 10")
1695 Call ok(testObj
.elseif = 10, "testObj.elseif = " & testObj
.elseif & " expected 10")
1696 Call ok(testObj
.end = 10, "testObj.end = " & testObj
.end & " expected 10")
1697 Call ok(testObj
.then = 10, "testObj.then = " & testObj
.then & " expected 10")
1698 Call ok(testObj
.exit = 10, "testObj.exit = " & testObj
.exit & " expected 10")
1699 Call ok(testObj
.while = 10, "testObj.while = " & testObj
.while & " expected 10")
1700 Call ok(testObj
.wend = 10, "testObj.wend = " & testObj
.wend & " expected 10")
1701 Call ok(testObj
.do = 10, "testObj.do = " & testObj
.do & " expected 10")
1702 Call ok(testObj
.loop = 10, "testObj.loop = " & testObj
.loop & " expected 10")
1703 Call ok(testObj
.until = 10, "testObj.until = " & testObj
.until & " expected 10")
1704 Call ok(testObj
.for = 10, "testObj.for = " & testObj
.for & " expected 10")
1705 Call ok(testObj
.to = 10, "testObj.to = " & testObj
.to & " expected 10")
1706 Call ok(testObj
.each = 10, "testObj.each = " & testObj
.each & " expected 10")
1707 Call ok(testObj
.in = 10, "testObj.in = " & testObj
.in & " expected 10")
1708 Call ok(testObj
.select = 10, "testObj.select = " & testObj
.select & " expected 10")
1709 Call ok(testObj
.case = 10, "testObj.case = " & testObj
.case & " expected 10")
1710 Call ok(testObj
.byref = 10, "testObj.byref = " & testObj
.byref & " expected 10")
1711 Call ok(testObj
.byval = 10, "testObj.byval = " & testObj
.byval & " expected 10")
1712 Call ok(testObj
.option = 10, "testObj.option = " & testObj
.option & " expected 10")
1713 Call ok(testObj
.nothing = 10, "testObj.nothing = " & testObj
.nothing & " expected 10")
1714 Call ok(testObj
.empty
= 10, "testObj.empty = " & testObj
.empty
& " expected 10")
1715 Call ok(testObj
.null
= 10, "testObj.null = " & testObj
.null
& " expected 10")
1716 Call ok(testObj
.class
= 10, "testObj.class = " & testObj
.class
& " expected 10")
1717 Call ok(testObj
.set = 10, "testObj.set = " & testObj
.set & " expected 10")
1718 Call ok(testObj
.new = 10, "testObj.new = " & testObj
.new & " expected 10")
1719 Call ok(testObj
.public = 10, "testObj.public = " & testObj
.public & " expected 10")
1720 Call ok(testObj
.private = 10, "testObj.private = " & testObj
.private & " expected 10")
1721 Call ok(testObj
.next = 10, "testObj.next = " & testObj
.next & " expected 10")
1722 Call ok(testObj
.on = 10, "testObj.on = " & testObj
.on & " expected 10")
1723 Call ok(testObj
.resume = 10, "testObj.resume = " & testObj
.resume & " expected 10")
1724 Call ok(testObj
.goto = 10, "testObj.goto = " & testObj
.goto & " expected 10")
1725 Call ok(testObj
.with = 10, "testObj.with = " & testObj
.with & " expected 10")
1726 Call ok(testObj
.redim = 10, "testObj.redim = " & testObj
.redim & " expected 10")
1727 Call ok(testObj
.preserve = 10, "testObj.preserve = " & testObj
.preserve & " expected 10")
1728 Call ok(testObj
.property = 10, "testObj.property = " & testObj
.property & " expected 10")
1729 Call ok(testObj
.me = 10, "testObj.me = " & testObj
.me & " expected 10")
1730 Call ok(testObj
.stop = 10, "testObj.stop = " & testObj
.stop & " expected 10")
1732 call test_dotIdentifiers
1734 ' Test End statements not required to be preceded by a newline or separator
1738 Sub EndTestSubWithCall
1740 Call ok(x
= 1, "x = " & x
)End Sub
1741 Call EndTestSubWithCall()
1743 Function EndTestFunc(x
)
1744 Call ok(x
> 0, "x = " & x
)End Function
1747 Class EndTestClassWithStorageId
1750 Class EndTestClassWithDim
1753 Class EndTestClassWithFunc
1754 Function test(ByVal x
)
1755 x
= 0 End Function End Class
1757 Class EndTestClassWithProperty
1759 Public default
Property Get defprop
1760 defprop
= x
End Property End Class
1762 class TestPropSyntax
1769 public default
property get def()
1779 Public Property Set bar(obj
)
1782 Public Property Set foo(par
,obj
)
1784 if obj is
Nothing Then gotNothing
= True
1787 Public Property Let Key(oldKey
,newKey
)
1788 oDict
= oldKey
& newKey
1790 Public Property Let three(uno
,due
,tre
)
1791 oDict
= uno
& due
& tre
1793 Public Property Let ten(a
,b
,c
,d
,e
,f
,g
,h
,i
,j
)
1794 oDict
= a
& b
& c
& d
& e
& f
& g
& h
& i
& j
1798 Set x
= new TestPropParam
1799 x
.key("old") = "new"
1800 call ok(x
.oDict
= "oldnew","x.oDict = " & x
.oDict
& " expected oldnew")
1802 call ok(x
.oDict
= "123","x.oDict = " & x
.oDict
& " expected 123")
1803 x
.ten(1,2,3,4,5,6,7,8,9) = 0
1804 call ok(x
.oDict
= "1234567890","x.oDict = " & x
.oDict
& " expected 1234567890")
1806 call ok(x
.gotNothing
=Empty
,"x.gotNothing = " & x
.gotNothing
& " expected Empty")
1807 Set x
.foo("123") = Nothing
1808 call ok(x
.oDict
= "123","x.oDict = " & x
.oDict
& " expected 123")
1809 call ok(x
.gotNothing
=True,"x.gotNothing = " & x
.gotNothing
& " expected true")
1811 set x
= new TestPropSyntax
1812 set x
.prop
= new TestPropSyntax
1813 set x
.prop
.prop
= new TestPropSyntax
1814 x
.prop
.prop
.prop
= 2
1815 call ok(x
.getProp().getProp
.prop
= 2, "x.getProp().getProp.prop = " & x
.getProp().getProp
.prop
)
1816 x
.getprop
.getprop().prop
= 3
1817 call ok(x
.getProp
.prop
.prop
= 3, "x.getProp.prop.prop = " & x
.getProp
.prop
.prop
)
1818 set x
.getprop
.getprop().prop
= new emptyclass
1819 set obj
= new emptyclass
1820 set x
.getprop
.getprop().prop
= obj
1821 call ok(x
.getprop
.getprop().prop is obj
, "x.getprop.getprop().prop is not obj (emptyclass)")
1823 ok
getVT(x
) = "VT_DISPATCH*", "getVT(x) = " & getVT(x
)
1824 todo_wine_ok
getVT(x()) = "VT_BSTR", "getVT(x()) = " & getVT(x())
1827 class DefaultSubTest1
1828 Public default
Sub init(a
)
1829 funcCalled
= "init" & a
1833 Set obj
= New DefaultSubTest1
1835 call ok(funcCalled
= "init1","funcCalled=" & funcCalled
)
1838 call ok(funcCalled
= "init2","funcCalled=" & funcCalled
)
1840 class DefaultSubTest2
1841 Public Default
Function init
1846 Set obj
= New DefaultSubTest2
1849 call ok(funcCalled
= "init","funcCalled=" & funcCalled
)
1851 ' todo this is not yet supported
1854 'call ok(funcCalled = "init","funcCalled=" & funcCalled)
1859 set x
= new TestPropSyntax
1862 ok
.prop
= 1, ".prop = "&.prop
1864 ok x
.prop
= 1, "x.prop = " & x
.prop
1866 with new TestPropSyntax
1868 ok
.prop
= 1, ".prop = "&.prop
1871 function testsetresult(x
, y
)
1872 set testsetresult
= new TestPropSyntax
1873 testsetresult
.prop
= x
1874 y
= testsetresult
.prop
+ 1
1877 set x
= testsetresult(1, 2)
1878 ok x
.prop
= 1, "x.prop = " & x
.prop
1880 set arr(0) = new TestPropSyntax
1882 ok
arr(0).prop
= 1, "arr(0) = " & arr(0).prop
1890 ok x
= true, "x = " & x