Reactos
1'
2' Copyright 2011 Jacek Caban for CodeWeavers
3'
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.
8'
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.
13'
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
17'
18
19OPTION EXPLICIT : : DIM W
20
21dim x, y, z
22Dim obj
23
24call ok(true, "true is not true?")
25ok true, "true is not true?"
26call ok((true), "true is not true?")
27
28ok not false, "not false but not true?"
29ok not not true, "not not true but not true?"
30
31Call ok(true = true, "true = true is false")
32Call ok(false = false, "false = false is false")
33Call ok(not (true = false), "true = false is true")
34Call ok("x" = "x", """x"" = ""x"" is false")
35Call ok(empty = empty, "empty = empty is false")
36Call ok(empty = "", "empty = """" is false")
37Call ok(0 = 0.0, "0 <> 0.0")
38Call ok(16 = &h10&, "16 <> &h10&")
39Call ok(010 = 10, "010 <> 10")
40Call ok(10. = 10, "10. <> 10")
41Call ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1")
42Call ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1")
43Call ok(34e5 = 3400000, "34e5 <> 3400000")
44Call ok(34e+5 = 3400000, "34e+5 <> 3400000")
45Call ok(56.789e5 = 5678900, "56.789e5 = 5678900")
46Call ok(56.789e-2 = 0.56789, "56.789e-2 <> 0.56789")
47Call ok(1e-94938484 = 0, "1e-... <> 0")
48Call ok(34e0 = 34, "34e0 <> 34")
49Call ok(34E1 = 340, "34E0 <> 340")
50Call ok(--1 = 1, "--1 = " & --1)
51Call ok(-empty = 0, "-empty = " & (-empty))
52Call ok(true = -1, "! true = -1")
53Call ok(false = 0, "false <> 0")
54Call ok(&hff = 255, "&hff <> 255")
55Call ok(&Hff = 255, "&Hff <> 255")
56
57W = 5
58Call ok(W = 5, "W = " & W & " expected " & 5)
59
60x = "xx"
61Call ok(x = "xx", "x = " & x & " expected ""xx""")
62
63Call ok(true <> false, "true <> false is false")
64Call ok(not (true <> true), "true <> true is true")
65Call ok(not ("x" <> "x"), """x"" <> ""x"" is true")
66Call ok(not (empty <> empty), "empty <> empty is true")
67Call ok(x <> "x", "x = ""x""")
68Call ok("true" <> true, """true"" = true is true")
69
70Call ok("" = true = false, """"" = true = false is false")
71Call ok(not(false = true = ""), "false = true = """" is true")
72Call ok(not (false = false <> false = false), "false = false <> false = false is true")
73Call ok(not ("" <> false = false), """"" <> false = false is true")
74
75Call ok(getVT(false) = "VT_BOOL", "getVT(false) is not VT_BOOL")
76Call ok(getVT(true) = "VT_BOOL", "getVT(true) is not VT_BOOL")
77Call ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR")
78Call ok(getVT("test") = "VT_BSTR", "getVT(""test"") is not VT_BSTR")
79Call ok(getVT(Empty) = "VT_EMPTY", "getVT(Empty) is not VT_EMPTY")
80Call ok(getVT(null) = "VT_NULL", "getVT(null) is not VT_NULL")
81Call ok(getVT(0) = "VT_I2", "getVT(0) is not VT_I2")
82Call ok(getVT(1) = "VT_I2", "getVT(1) is not VT_I2")
83Call ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8")
84Call ok(getVT(0.0) = "VT_R8", "getVT(0.0) is not VT_R8")
85Call ok(getVT(2147483647) = "VT_I4", "getVT(2147483647) is not VT_I4")
86Call ok(getVT(2147483648) = "VT_R8", "getVT(2147483648) is not VT_R8")
87Call ok(getVT(&h10&) = "VT_I2", "getVT(&h10&) is not VT_I2")
88Call ok(getVT(&h10000&) = "VT_I4", "getVT(&h10000&) is not VT_I4")
89Call ok(getVT(&H10000&) = "VT_I4", "getVT(&H10000&) is not VT_I4")
90Call ok(getVT(&hffFFffFF&) = "VT_I2", "getVT(&hffFFffFF&) is not VT_I2")
91Call ok(getVT(1e2) = "VT_R8", "getVT(1e2) is not VT_R8")
92Call ok(getVT(1e0) = "VT_R8", "getVT(1e0) is not VT_R8")
93Call ok(getVT(0.1e2) = "VT_R8", "getVT(0.1e2) is not VT_R8")
94Call ok(getVT(1 & 100000) = "VT_BSTR", "getVT(1 & 100000) is not VT_BSTR")
95Call ok(getVT(-empty) = "VT_I2", "getVT(-empty) = " & getVT(-empty))
96Call ok(getVT(-null) = "VT_NULL", "getVT(-null) = " & getVT(-null))
97Call ok(getVT(y) = "VT_EMPTY*", "getVT(y) = " & getVT(y))
98Call ok(getVT(nothing) = "VT_DISPATCH", "getVT(nothing) = " & getVT(nothing))
99set x = nothing
100Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x=nothing) = " & getVT(x))
101x = true
102Call ok(getVT(x) = "VT_BOOL*", "getVT(x) = " & getVT(x))
103Call ok(getVT(false or true) = "VT_BOOL", "getVT(false) is not VT_BOOL")
104x = "x"
105Call ok(getVT(x) = "VT_BSTR*", "getVT(x) is not VT_BSTR*")
106x = 0.0
107Call ok(getVT(x) = "VT_R8*", "getVT(x) = " & getVT(x))
108
109Call ok(isNullDisp(nothing), "nothing is not nulldisp?")
110
111x = "xx"
112Call ok("ab" & "cd" = "abcd", """ab"" & ""cd"" <> ""abcd""")
113Call ok("ab " & null = "ab ", """ab"" & null = " & ("ab " & null))
114Call ok("ab " & empty = "ab ", """ab"" & empty = " & ("ab " & empty))
115Call ok(1 & 100000 = "1100000", "1 & 100000 = " & (1 & 100000))
116Call ok("ab" & x = "abxx", """ab"" & x = " & ("ab"&x))
117
118if(isEnglishLang) then
119 Call ok("" & true = "True", """"" & true = " & true)
120 Call ok(true & false = "TrueFalse", "true & false = " & (true & false))
121end if
122
123call ok(true and true, "true and true is not true")
124call ok(true and not false, "true and not false is not true")
125call ok(not (false and true), "not (false and true) is not true")
126call ok(getVT(null and true) = "VT_NULL", "getVT(null and true) = " & getVT(null and true))
127
128call ok(false or true, "false or uie is false?")
129call ok(not (false or false), "false or false is not false?")
130call ok(false and false or true, "false and false or true is false?")
131call ok(true or false and false, "true or false and false is false?")
132call ok(null or true, "null or true is false")
133
134call ok(true xor false, "true xor false is false?")
135call ok(not (false xor false), "false xor false is true?")
136call ok(not (true or false xor true), "true or false xor true is true?")
137call ok(not (true xor false or true), "true xor false or true is true?")
138
139call ok(false eqv false, "false does not equal false?")
140call ok(not (false eqv true), "false equals true?")
141call ok(getVT(false eqv null) = "VT_NULL", "getVT(false eqv null) = " & getVT(false eqv null))
142
143call ok(true imp true, "true does not imp true?")
144call ok(false imp false, "false does not imp false?")
145call ok(not (true imp false), "true imp false?")
146call ok(false imp null, "false imp null is false?")
147
148Call ok(2 >= 1, "! 2 >= 1")
149Call ok(2 >= 2, "! 2 >= 2")
150Call ok(not(true >= 2), "true >= 2 ?")
151Call ok(2 > 1, "! 2 > 1")
152Call ok(false > true, "! false < true")
153Call ok(0 > true, "! 0 > true")
154Call ok(not (true > 0), "true > 0")
155Call ok(not (0 > 1 = 1), "0 > 1 = 1")
156Call ok(1 < 2, "! 1 < 2")
157Call ok(1 = 1 < 0, "! 1 = 1 < 0")
158Call ok(1 <= 2, "! 1 <= 2")
159Call ok(2 <= 2, "! 2 <= 2")
160
161Call ok(isNull(0 = null), "'(0 = null)' is not null")
162Call ok(isNull(null = 1), "'(null = 1)' is not null")
163Call ok(isNull(0 > null), "'(0 > null)' is not null")
164Call ok(isNull(null > 1), "'(null > 1)' is not null")
165Call ok(isNull(0 < null), "'(0 < null)' is not null")
166Call ok(isNull(null < 1), "'(null < 1)' is not null")
167Call ok(isNull(0 <> null), "'(0 <> null)' is not null")
168Call ok(isNull(null <> 1), "'(null <> 1)' is not null")
169Call ok(isNull(0 >= null), "'(0 >= null)' is not null")
170Call ok(isNull(null >= 1), "'(null >= 1)' is not null")
171Call ok(isNull(0 <= null), "'(0 <= null)' is not null")
172Call ok(isNull(null <= 1), "'(null <= 1)' is not null")
173
174x = 3
175Call ok(2+2 = 4, "2+2 = " & (2+2))
176Call ok(false + 6 + true = 5, "false + 6 + true <> 5")
177Call ok(getVT(2+null) = "VT_NULL", "getVT(2+null) = " & getVT(2+null))
178Call ok(2+empty = 2, "2+empty = " & (2+empty))
179Call ok(x+x = 6, "x+x = " & (x+x))
180
181Call ok(5-1 = 4, "5-1 = " & (5-1))
182Call ok(3+5-true = 9, "3+5-true <> 9")
183Call ok(getVT(2-null) = "VT_NULL", "getVT(2-null) = " & getVT(2-null))
184Call ok(2-empty = 2, "2-empty = " & (2-empty))
185Call ok(2-x = -1, "2-x = " & (2-x))
186
187Call ok(9 Mod 6 = 3, "9 Mod 6 = " & (9 Mod 6))
188Call ok(11.6 Mod 5.5 = False, "11.6 Mod 5.5 = " & (11.6 Mod 5.5 = 0.6))
189Call ok(7 Mod 4+2 = 5, "7 Mod 4+2 <> 5")
190Call ok(getVT(2 mod null) = "VT_NULL", "getVT(2 mod null) = " & getVT(2 mod null))
191Call ok(getVT(null mod 2) = "VT_NULL", "getVT(null mod 2) = " & getVT(null mod 2))
192'FIXME: Call ok(empty mod 2 = 0, "empty mod 2 = " & (empty mod 2))
193
194Call ok(5 \ 2 = 2, "5 \ 2 = " & (5\2))
195Call ok(4.6 \ 1.5 = 2, "4.6 \ 1.5 = " & (4.6\1.5))
196Call ok(4.6 \ 1.49 = 5, "4.6 \ 1.49 = " & (4.6\1.49))
197Call ok(2+3\4 = 2, "2+3\4 = " & (2+3\4))
198
199Call ok(2*3 = 6, "2*3 = " & (2*3))
200Call ok(3/2 = 1.5, "3/2 = " & (3/2))
201Call ok(5\4/2 = 2, "5\4/2 = " & (5\2/1))
202Call ok(12/3\2 = 2, "12/3\2 = " & (12/3\2))
203Call ok(5/1000000 = 0.000005, "5/1000000 = " & (5/1000000))
204
205Call ok(2^3 = 8, "2^3 = " & (2^3))
206Call ok(2^3^2 = 64, "2^3^2 = " & (2^3^2))
207Call ok(-3^2 = 9, "-3^2 = " & (-3^2))
208Call ok(2*3^2 = 18, "2*3^2 = " & (2*3^2))
209
210x =_
211 3
212x _
213 = 3
214
215x = 3
216
217if true then y = true : x = y
218ok x, "x is false"
219
220x = true : if false then x = false
221ok x, "x is false, if false called?"
222
223if not false then x = true
224ok x, "x is false, if not false not called?"
225
226if not false then x = "test" : x = true
227ok x, "x is false, if not false not called?"
228
229if false then x = y : call ok(false, "if false .. : called")
230
231if false then x = y : call ok(false, "if false .. : called") else x = "else"
232Call ok(x = "else", "else not called?")
233
234if true then x = y else y = x : Call ok(false, "in else?")
235
236if false then :
237
238if false then x = y : if true then call ok(false, "embedded if called")
239
240if false then x=1 else x=2 end if
241if true then x=1 end if
242
243x = false
244if false then x = true : x = true
245Call ok(x = false, "x <> false")
246
247if false then
248 ok false, "if false called"
249end if
250
251x = true
252if x then
253 x = false
254end if
255Call ok(not x, "x is false, if not evaluated?")
256
257x = false
258If false Then
259 Call ok(false, "inside if false")
260Else
261 x = true
262End If
263Call ok(x, "else not called?")
264
265x = false
266If false Then
267 Call ok(false, "inside if false")
268ElseIf not True Then
269 Call ok(false, "inside elseif not true")
270Else
271 x = true
272End If
273Call ok(x, "else not called?")
274
275x = false
276If false Then
277 Call ok(false, "inside if false")
278 x = 1
279 y = 10+x
280ElseIf not False Then
281 x = true
282Else
283 Call ok(false, "inside else not true")
284End If
285Call ok(x, "elseif not called?")
286
287x = false
288If false Then
289 Call ok(false, "inside if false")
290ElseIf not False Then
291 x = true
292End If
293Call ok(x, "elseif not called?")
294
295x = false
296if 1 then x = true
297Call ok(x, "if 1 not run?")
298
299x = false
300if &h10000& then x = true
301Call ok(x, "if &h10000& not run?")
302
303x = false
304y = false
305while not (x and y)
306 if x then
307 y = true
308 end if
309 x = true
310wend
311call ok((x and y), "x or y is false after while")
312
313if false then
314' empty body
315end if
316
317if false then
318 x = false
319elseif true then
320' empty body
321end if
322
323if false then
324 x = false
325else
326' empty body
327end if
328
329while false
330wend
331
332x = 0
333WHILE x < 3 : x = x + 1
334Wend
335Call ok(x = 3, "x not equal to 3")
336
337z = 2
338while z > -4 :
339
340
341z = z -2
342wend
343
344x = false
345y = false
346do while not (x and y)
347 if x then
348 y = true
349 end if
350 x = true
351loop
352call ok((x and y), "x or y is false after while")
353
354do while false
355loop
356
357do while true
358 exit do
359 ok false, "exit do didn't work"
360loop
361
362x = 0
363Do While x < 2 : x = x + 1
364Loop
365Call ok(x = 2, "x not equal to 2")
366
367x = 0
368Do While x >= -2 :
369x = x - 1
370Loop
371Call ok(x = -3, "x not equal to -3")
372
373x = false
374y = false
375do until x and y
376 if x then
377 y = true
378 end if
379 x = true
380loop
381call ok((x and y), "x or y is false after do until")
382
383do until true
384loop
385
386do until false
387 exit do
388 ok false, "exit do didn't work"
389loop
390
391x = 0
392Do: :: x = x + 2
393Loop Until x = 4
394Call ok(x = 4, "x not equal to 4")
395
396x = 5
397Do: :
398
399: x = x * 2
400Loop Until x = 40
401Call ok(x = 40, "x not equal to 40")
402
403
404x = false
405do
406 if x then exit do
407 x = true
408loop
409call ok(x, "x is false after do..loop?")
410
411x = 0
412Do :If x = 6 Then
413 Exit Do
414 End If
415 x = x + 3
416Loop
417Call ok(x = 6, "x not equal to 6")
418
419x = false
420y = false
421do
422 if x then
423 y = true
424 end if
425 x = true
426loop until x and y
427call ok((x and y), "x or y is false after while")
428
429do
430loop until true
431
432do
433 exit do
434 ok false, "exit do didn't work"
435loop until false
436
437x = false
438y = false
439do
440 if x then
441 y = true
442 end if
443 x = true
444loop while not (x and y)
445call ok((x and y), "x or y is false after while")
446
447do
448loop while false
449
450do
451 exit do
452 ok false, "exit do didn't work"
453loop while true
454
455y = "for1:"
456for x = 5 to 8
457 y = y & " " & x
458next
459Call ok(y = "for1: 5 6 7 8", "y = " & y)
460
461y = "for2:"
462for x = 5 to 8 step 2
463 y = y & " " & x
464next
465Call ok(y = "for2: 5 7", "y = " & y)
466
467y = "for3:"
468x = 2
469for x = x+3 to 8
470 y = y & " " & x
471next
472Call ok(y = "for3: 5 6 7 8", "y = " & y)
473
474y = "for4:"
475for x = 5 to 4
476 y = y & " " & x
477next
478Call ok(y = "for4:", "y = " & y)
479
480y = "for5:"
481for x = 5 to 3 step true
482 y = y & " " & x
483next
484Call ok(y = "for5: 5 4 3", "y = " & y)
485
486y = "for6:"
487z = 4
488for x = 5 to z step 3-4
489 y = y & " " & x
490 z = 0
491next
492Call ok(y = "for6: 5 4", "y = " & y)
493
494y = "for7:"
495z = 1
496for x = 5 to 8 step z
497 y = y & " " & x
498 z = 2
499next
500Call ok(y = "for7: 5 6 7 8", "y = " & y)
501
502z = 0
503For x = 10 To 18 Step 2 : : z = z + 1
504Next
505Call ok(z = 5, "z not equal to 5")
506
507y = "for8:"
508for x = 5 to 8
509 y = y & " " & x
510 x = x+1
511next
512Call ok(y = "for8: 5 7", "y = " & y)
513
514for x = 1.5 to 1
515 Call ok(false, "for..to called when unexpected")
516next
517
518for x = 1 to 100
519 exit for
520 Call ok(false, "exit for not escaped the loop?")
521next
522
523for x = 1 to 5 :
524:
525: :exit for
526 Call ok(false, "exit for not escaped the loop?")
527next
528
529do while true
530 for x = 1 to 100
531 exit do
532 next
533loop
534
535if null then call ok(false, "if null evaluated")
536
537while null
538 call ok(false, "while null evaluated")
539wend
540
541Call collectionObj.reset()
542y = 0
543for each x in collectionObj :
544
545 :y = y + 3
546next
547Call ok(y = 9, "y = " & y)
548
549Call collectionObj.reset()
550y = 0
551x = 10
552z = 0
553for each x in collectionObj : z = z + 2
554 y = y+1
555 Call ok(x = y, "x <> y")
556next
557Call ok(y = 3, "y = " & y)
558Call ok(z = 6, "z = " & z)
559Call ok(getVT(x) = "VT_EMPTY*", "getVT(x) = " & getVT(x))
560
561Call collectionObj.reset()
562y = false
563for each x in collectionObj
564 if x = 2 then exit for
565 y = 1
566next
567Call ok(y = 1, "y = " & y)
568Call ok(x = 2, "x = " & x)
569
570Set obj = collectionObj
571Call obj.reset()
572y = 0
573x = 10
574for each x in obj
575 y = y+1
576 Call ok(x = y, "x <> y")
577next
578Call ok(y = 3, "y = " & y)
579Call ok(getVT(x) = "VT_EMPTY*", "getVT(x) = " & getVT(x))
580
581x = false
582select case 3
583 case 2
584 Call ok(false, "unexpected case")
585 case 2
586 Call ok(false, "unexpected case")
587 case 4
588 Call ok(false, "unexpected case")
589 case "test"
590 case "another case"
591 Call ok(false, "unexpected case")
592 case 0, false, 2+1, 10
593 x = true
594 case ok(false, "unexpected case")
595 Call ok(false, "unexpected case")
596 case else
597 Call ok(false, "unexpected case")
598end select
599Call ok(x, "wrong case")
600
601x = false
602select case 3
603 case 3
604 x = true
605end select
606Call ok(x, "wrong case")
607
608x = false
609select case 2+2
610 case 3
611 Call ok(false, "unexpected case")
612 case else
613 x = true
614end select
615Call ok(x, "wrong case")
616
617y = "3"
618x = false
619select case y
620 case "3"
621 x = true
622 case 3
623 Call ok(false, "unexpected case")
624end select
625Call ok(x, "wrong case")
626
627select case 0
628 case 1
629 Call ok(false, "unexpected case")
630 case "2"
631 Call ok(false, "unexpected case")
632end select
633
634select case 0
635end select
636
637x = false
638select case 2
639 case 3,1,2,4: x = true
640 case 5,6,7
641 Call ok(false, "unexpected case")
642end select
643Call ok(x, "wrong case")
644
645x = false
646select case 2: case 5,6,7: Call ok(false, "unexpected case")
647 case 2,1,2,4
648 x = true
649 case else: Call ok(false, "unexpected case else")
650end select
651Call ok(x, "wrong case")
652
653x = False
654select case 1 :
655
656 :case 3, 4 :
657
658
659 case 5
660:
661 Call ok(false, "unexpected case") :
662 Case Else:
663
664 x = True
665end select
666Call ok(x, "wrong case")
667
668if false then
669Sub testsub
670 x = true
671End Sub
672end if
673
674x = false
675Call testsub
676Call ok(x, "x is false, testsub not called?")
677
678Sub SubSetTrue(v)
679 Call ok(not v, "v is not true")
680 v = true
681End Sub
682
683x = false
684SubSetTrue x
685Call ok(x, "x was not set by SubSetTrue")
686
687SubSetTrue false
688Call ok(not false, "false is no longer false?")
689
690Sub SubSetTrue2(ByRef v)
691 Call ok(not v, "v is not true")
692 v = true
693End Sub
694
695x = false
696SubSetTrue2 x
697Call ok(x, "x was not set by SubSetTrue")
698
699Sub TestSubArgVal(ByVal v)
700 Call ok(not v, "v is not false")
701 v = true
702 Call ok(v, "v is not true?")
703End Sub
704
705x = false
706Call TestSubArgVal(x)
707Call ok(not x, "x is true after TestSubArgVal call?")
708
709Sub TestSubMultiArgs(a,b,c,d,e)
710 Call ok(a=1, "a = " & a)
711 Call ok(b=2, "b = " & b)
712 Call ok(c=3, "c = " & c)
713 Call ok(d=4, "d = " & d)
714 Call ok(e=5, "e = " & e)
715End Sub
716
717Sub TestSubExit(ByRef a)
718 If a Then
719 Exit Sub
720 End If
721 Call ok(false, "Exit Sub not called?")
722End Sub
723
724Call TestSubExit(true)
725
726Sub TestSubExit2
727 for x = 1 to 100
728 Exit Sub
729 next
730End Sub
731Call TestSubExit2
732
733TestSubMultiArgs 1, 2, 3, 4, 5
734Call TestSubMultiArgs(1, 2, 3, 4, 5)
735
736Sub TestSubLocalVal
737 x = false
738 Call ok(not x, "local x is not false?")
739 Dim x
740 Dim a,b, c
741End Sub
742
743x = true
744y = true
745Call TestSubLocalVal
746Call ok(x, "global x is not true?")
747
748Public Sub TestPublicSub
749End Sub
750Call TestPublicSub
751
752Private Sub TestPrivateSub
753End Sub
754Call TestPrivateSub
755
756Public Sub TestSeparatorSub : :
757:
758End Sub
759Call TestSeparatorSub
760
761if false then
762Function testfunc
763 x = true
764End Function
765end if
766
767x = false
768Call TestFunc
769Call ok(x, "x is false, testfunc not called?")
770
771Function FuncSetTrue(v)
772 Call ok(not v, "v is not true")
773 v = true
774End Function
775
776x = false
777FuncSetTrue x
778Call ok(x, "x was not set by FuncSetTrue")
779
780FuncSetTrue false
781Call ok(not false, "false is no longer false?")
782
783Function FuncSetTrue2(ByRef v)
784 Call ok(not v, "v is not true")
785 v = true
786End Function
787
788x = false
789FuncSetTrue2 x
790Call ok(x, "x was not set by FuncSetTrue")
791
792Function TestFuncArgVal(ByVal v)
793 Call ok(not v, "v is not false")
794 v = true
795 Call ok(v, "v is not true?")
796End Function
797
798x = false
799Call TestFuncArgVal(x)
800Call ok(not x, "x is true after TestFuncArgVal call?")
801
802Function TestFuncMultiArgs(a,b,c,d,e)
803 Call ok(a=1, "a = " & a)
804 Call ok(b=2, "b = " & b)
805 Call ok(c=3, "c = " & c)
806 Call ok(d=4, "d = " & d)
807 Call ok(e=5, "e = " & e)
808End Function
809
810TestFuncMultiArgs 1, 2, 3, 4, 5
811Call TestFuncMultiArgs(1, 2, 3, 4, 5)
812
813Function TestFuncLocalVal
814 x = false
815 Call ok(not x, "local x is not false?")
816 Dim x
817End Function
818
819x = true
820y = true
821Call TestFuncLocalVal
822Call ok(x, "global x is not true?")
823
824Function TestFuncExit(ByRef a)
825 If a Then
826 Exit Function
827 End If
828 Call ok(false, "Exit Function not called?")
829End Function
830
831Call TestFuncExit(true)
832
833Function TestFuncExit2(ByRef a)
834 For x = 1 to 100
835 For y = 1 to 100
836 Exit Function
837 Next
838 Next
839 Call ok(false, "Exit Function not called?")
840End Function
841
842Call TestFuncExit2(true)
843
844Sub SubParseTest
845End Sub : x = false
846Call SubParseTest
847
848Function FuncParseTest
849End Function : x = false
850
851Function ReturnTrue
852 ReturnTrue = false
853 ReturnTrue = true
854End Function
855
856Call ok(ReturnTrue(), "ReturnTrue returned false?")
857
858Function SetVal(ByRef x, ByVal v)
859 x = v
860 SetVal = x
861 Exit Function
862End Function
863
864x = false
865ok SetVal(x, true), "SetVal returned false?"
866Call ok(x, "x is not set to true by SetVal?")
867
868Public Function TestPublicFunc
869End Function
870Call TestPublicFunc
871
872Private Function TestPrivateFunc
873End Function
874Call TestPrivateFunc
875
876Public Function TestSepFunc(ByVal a) : :
877: TestSepFunc = a
878End Function
879Call ok(TestSepFunc(1) = 1, "Function did not return 1")
880
881
882' Stop has an effect only in debugging mode
883Stop
884
885set x = testObj
886Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x=testObj) = " & getVT(x))
887
888Set obj = New EmptyClass
889Call ok(getVT(obj) = "VT_DISPATCH*", "getVT(obj) = " & getVT(obj))
890
891Class EmptyClass
892End Class
893
894Set x = obj
895Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x) = " & getVT(x))
896
897Class TestClass
898 Public publicProp
899
900 Private privateProp
901
902 Public Function publicFunction()
903 privateSub()
904 publicFunction = 4
905 End Function
906
907 Public Property Get gsProp()
908 gsProp = privateProp
909 funcCalled = "gsProp get"
910 exit property
911 Call ok(false, "exit property not returned?")
912 End Property
913
914 Public Default Property Get DefValGet
915 DefValGet = privateProp
916 funcCalled = "GetDefVal"
917 End Property
918
919 Public Property Let DefValGet(x)
920 End Property
921
922 Public publicProp2
923
924 Public Sub publicSub
925 End Sub
926
927 Public Property Let gsProp(val)
928 privateProp = val
929 funcCalled = "gsProp let"
930 exit property
931 Call ok(false, "exit property not returned?")
932 End Property
933
934 Public Property Set gsProp(val)
935 funcCalled = "gsProp set"
936 exit property
937 Call ok(false, "exit property not returned?")
938 End Property
939
940 Public Sub setPrivateProp(x)
941 privateProp = x
942 End Sub
943
944 Function getPrivateProp
945 getPrivateProp = privateProp
946 End Function
947
948 Private Sub privateSub
949 End Sub
950
951 Public Sub Class_Initialize
952 publicProp2 = 2
953 privateProp = true
954 Call ok(getVT(privateProp) = "VT_BOOL*", "getVT(privateProp) = " & getVT(privateProp))
955 Call ok(getVT(publicProp2) = "VT_I2*", "getVT(publicProp2) = " & getVT(publicProp2))
956 Call ok(getVT(Me.publicProp2) = "VT_I2", "getVT(Me.publicProp2) = " & getVT(Me.publicProp2))
957 End Sub
958
959 Property Get gsGetProp(x)
960 gsGetProp = x
961 End Property
962End Class
963
964Call testDisp(new testClass)
965
966Set obj = New TestClass
967
968Call ok(obj.publicFunction = 4, "obj.publicFunction = " & obj.publicFunction)
969Call ok(obj.publicFunction() = 4, "obj.publicFunction() = " & obj.publicFunction())
970
971obj.publicSub()
972Call obj.publicSub
973Call obj.publicFunction()
974
975Call ok(getVT(obj.publicProp) = "VT_EMPTY", "getVT(obj.publicProp) = " & getVT(obj.publicProp))
976obj.publicProp = 3
977Call ok(getVT(obj.publicProp) = "VT_I2", "getVT(obj.publicProp) = " & getVT(obj.publicProp))
978Call ok(obj.publicProp = 3, "obj.publicProp = " & obj.publicProp)
979obj.publicProp() = 3
980
981Call ok(obj.getPrivateProp() = true, "obj.getPrivateProp() = " & obj.getPrivateProp())
982Call obj.setPrivateProp(6)
983Call ok(obj.getPrivateProp = 6, "obj.getPrivateProp = " & obj.getPrivateProp)
984
985Dim funcCalled
986funcCalled = ""
987Call ok(obj.gsProp = 6, "obj.gsProp = " & obj.gsProp)
988Call ok(funcCalled = "gsProp get", "funcCalled = " & funcCalled)
989obj.gsProp = 3
990Call ok(funcCalled = "gsProp let", "funcCalled = " & funcCalled)
991Call ok(obj.getPrivateProp = 3, "obj.getPrivateProp = " & obj.getPrivateProp)
992Set obj.gsProp = New testclass
993Call ok(funcCalled = "gsProp set", "funcCalled = " & funcCalled)
994
995x = obj
996Call ok(x = 3, "(x = obj) = " & x)
997Call ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled)
998funcCalled = ""
999Call ok(obj = 3, "(x = obj) = " & obj)
1000Call ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled)
1001
1002Call obj.Class_Initialize
1003Call ok(obj.getPrivateProp() = true, "obj.getPrivateProp() = " & obj.getPrivateProp())
1004
1005x = (New testclass).publicProp
1006
1007Class TermTest
1008 Public Sub Class_Terminate()
1009 funcCalled = "terminate"
1010 End Sub
1011End Class
1012
1013Set obj = New TermTest
1014funcCalled = ""
1015Set obj = Nothing
1016Call ok(funcCalled = "terminate", "funcCalled = " & funcCalled)
1017
1018Set obj = New TermTest
1019funcCalled = ""
1020Call obj.Class_Terminate
1021Call ok(funcCalled = "terminate", "funcCalled = " & funcCalled)
1022funcCalled = ""
1023Set obj = Nothing
1024Call ok(funcCalled = "terminate", "funcCalled = " & funcCalled)
1025
1026Call (New testclass).publicSub()
1027Call (New testclass).publicSub
1028
1029class PropTest
1030 property get prop0()
1031 prop0 = 1
1032 end property
1033
1034 property get prop1(x)
1035 prop1 = x+1
1036 end property
1037
1038 property get prop2(x, y)
1039 prop2 = x+y
1040 end property
1041end class
1042
1043set obj = new PropTest
1044
1045call ok(obj.prop0 = 1, "obj.prop0 = " & obj.prop0)
1046call ok(obj.prop1(3) = 4, "obj.prop1(3) = " & obj.prop1(3))
1047call ok(obj.prop2(3,4) = 7, "obj.prop2(3,4) = " & obj.prop2(3,4))
1048call obj.prop0()
1049call obj.prop1(2)
1050call obj.prop2(3,4)
1051
1052x = "following ':' is correct syntax" :
1053x = "following ':' is correct syntax" :: :
1054:: x = "also correct syntax"
1055rem another ugly way for comments
1056x = "rem as simplestatement" : rem rem comment
1057:
1058
1059Set obj = new EmptyClass
1060Set x = obj
1061Set y = new EmptyClass
1062
1063Call ok(obj is x, "obj is not x")
1064Call ok(x is obj, "x is not obj")
1065Call ok(not (obj is y), "obj is not y")
1066Call ok(not obj is y, "obj is not y")
1067Call ok(not (x is Nothing), "x is 1")
1068Call ok(Nothing is Nothing, "Nothing is not Nothing")
1069Call ok(x is obj and true, "x is obj and true is false")
1070
1071Class TestMe
1072 Public Sub Test(MyMe)
1073 Call ok(Me is MyMe, "Me is not MyMe")
1074 End Sub
1075End Class
1076
1077Set obj = New TestMe
1078Call obj.test(obj)
1079
1080Call ok(getVT(test) = "VT_DISPATCH", "getVT(test) = " & getVT(test))
1081Call ok(Me is Test, "Me is not Test")
1082
1083Const c1 = 1, c2 = 2, c3 = -3
1084Call ok(c1 = 1, "c1 = " & c1)
1085Call ok(getVT(c1) = "VT_I2", "getVT(c1) = " & getVT(c1))
1086Call ok(c3 = -3, "c3 = " & c3)
1087Call ok(getVT(c3) = "VT_I2", "getVT(c3) = " & getVT(c3))
1088
1089Const cb = True, cs = "test", cnull = null
1090Call ok(cb, "cb = " & cb)
1091Call ok(getVT(cb) = "VT_BOOL", "getVT(cb) = " & getVT(cb))
1092Call ok(cs = "test", "cs = " & cs)
1093Call ok(getVT(cs) = "VT_BSTR", "getVT(cs) = " & getVT(cs))
1094Call ok(isNull(cnull), "cnull = " & cnull)
1095Call ok(getVT(cnull) = "VT_NULL", "getVT(cnull) = " & getVT(cnull))
1096
1097Call ok(+1 = 1, "+1 != 1")
1098Call ok(+true = true, "+1 != 1")
1099Call ok(getVT(+true) = "VT_BOOL", "getVT(+true) = " & getVT(+true))
1100Call ok(+"true" = "true", """+true"" != true")
1101Call ok(getVT(+"true") = "VT_BSTR", "getVT(+""true"") = " & getVT(+"true"))
1102Call ok(+obj is obj, "+obj != obj")
1103Call ok(+--+-+1 = -1, "+--+-+1 != -1")
1104
1105if false then Const conststr = "str"
1106Call ok(conststr = "str", "conststr = " & conststr)
1107Call ok(getVT(conststr) = "VT_BSTR", "getVT(conststr) = " & getVT(conststr))
1108Call ok(conststr = "str", "conststr = " & conststr)
1109
1110Sub ConstTestSub
1111 Const funcconst = 1
1112 Call ok(c1 = 1, "c1 = " & c1)
1113 Call ok(funcconst = 1, "funcconst = " & funcconst)
1114End Sub
1115
1116Call ConstTestSub
1117Dim funcconst
1118
1119' Property may be used as an identifier (although it's a keyword)
1120Sub TestProperty
1121 Dim Property
1122 PROPERTY = true
1123 Call ok(property, "property = " & property)
1124
1125 for property = 1 to 2
1126 next
1127End Sub
1128
1129Call TestProperty
1130
1131Class Property
1132 Public Sub Property()
1133 End Sub
1134
1135 Sub Test(byref property)
1136 End Sub
1137End Class
1138
1139Class Property2
1140 Function Property()
1141 End Function
1142
1143 Sub Test(property)
1144 End Sub
1145
1146 Sub Test2(byval property)
1147 End Sub
1148End Class
1149
1150Class SeparatorTest : : Dim varTest1
1151:
1152 Private Sub Class_Initialize : varTest1 = 1
1153 End Sub ::
1154
1155 Property Get Test1() :
1156 Test1 = varTest1
1157 End Property ::
1158: :
1159 Property Let Test1(a) :
1160 varTest1 = a
1161 End Property :
1162
1163 Public Function AddToTest1(ByVal a) :: :
1164 varTest1 = varTest1 + a
1165 AddToTest1 = varTest1
1166 End Function : End Class : :: Set obj = New SeparatorTest
1167
1168Call ok(obj.Test1 = 1, "obj.Test1 is not 1")
1169obj.Test1 = 6
1170Call ok(obj.Test1 = 6, "obj.Test1 is not 6")
1171obj.AddToTest1(5)
1172Call ok(obj.Test1 = 11, "obj.Test1 is not 11")
1173
1174' Array tests
1175
1176Call ok(getVT(arr) = "VT_EMPTY*", "getVT(arr) = " & getVT(arr))
1177
1178Dim arr(3)
1179Dim arr2(4,3), arr3(5,4,3), arr0(0), noarr()
1180
1181Call ok(getVT(arr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr) = " & getVT(arr))
1182Call ok(getVT(arr2) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr2) = " & getVT(arr2))
1183Call ok(getVT(arr0) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(arr0) = " & getVT(arr0))
1184Call ok(getVT(noarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(noarr) = " & getVT(noarr))
1185
1186Call testArray(1, arr)
1187Call testArray(2, arr2)
1188Call testArray(3, arr3)
1189Call testArray(0, arr0)
1190Call testArray(-1, noarr)
1191
1192Call ok(getVT(arr(1)) = "VT_EMPTY*", "getVT(arr(1)) = " & getVT(arr(1)))
1193Call ok(getVT(arr2(1,2)) = "VT_EMPTY*", "getVT(arr2(1,2)) = " & getVT(arr2(1,2)))
1194Call ok(getVT(arr3(1,2,2)) = "VT_EMPTY*", "getVT(arr3(1,2,3)) = " & getVT(arr3(1,2,2)))
1195Call ok(getVT(arr(0)) = "VT_EMPTY*", "getVT(arr(0)) = " & getVT(arr(0)))
1196Call ok(getVT(arr(3)) = "VT_EMPTY*", "getVT(arr(3)) = " & getVT(arr(3)))
1197Call ok(getVT(arr0(0)) = "VT_EMPTY*", "getVT(arr0(0)) = " & getVT(arr0(0)))
1198
1199arr(2) = 3
1200Call ok(arr(2) = 3, "arr(2) = " & arr(2))
1201Call ok(getVT(arr(2)) = "VT_I2*", "getVT(arr(2)) = " & getVT(arr(2)))
1202
1203arr3(3,2,1) = 1
1204arr3(1,2,3) = 2
1205Call ok(arr3(3,2,1) = 1, "arr3(3,2,1) = " & arr3(3,2,1))
1206Call ok(arr3(1,2,3) = 2, "arr3(1,2,3) = " & arr3(1,2,3))
1207arr2(4,3) = 1
1208Call ok(arr2(4,3) = 1, "arr2(4,3) = " & arr2(4,3))
1209
1210x = arr3
1211Call ok(x(3,2,1) = 1, "x(3,2,1) = " & x(3,2,1))
1212
1213Function getarr()
1214 Dim arr(3)
1215 arr(2) = 2
1216 getarr = arr
1217 arr(3) = 3
1218End Function
1219
1220x = getarr()
1221Call ok(getVT(x) = "VT_ARRAY|VT_VARIANT*", "getVT(x) = " & getVT(x))
1222Call ok(x(2) = 2, "x(2) = " & x(2))
1223Call ok(getVT(x(3)) = "VT_EMPTY*", "getVT(x(3)) = " & getVT(x(3)))
1224
1225x(1) = 1
1226Call ok(x(1) = 1, "x(1) = " & x(1))
1227x = getarr()
1228Call ok(getVT(x(1)) = "VT_EMPTY*", "getVT(x(1)) = " & getVT(x(1)))
1229Call ok(x(2) = 2, "x(2) = " & x(2))
1230
1231x(1) = 1
1232y = x
1233x(1) = 2
1234Call ok(y(1) = 1, "y(1) = " & y(1))
1235
1236for x=1 to 1
1237 Dim forarr(3)
1238 if x=1 then
1239 Call ok(getVT(forarr(1)) = "VT_EMPTY*", "getVT(forarr(1)) = " & getVT(forarr(1)))
1240 else
1241 Call ok(forarr(1) = x, "forarr(1) = " & forarr(1))
1242 end if
1243 forarr(1) = x+1
1244next
1245
1246x=1
1247Call ok(forarr(x) = 2, "forarr(x) = " & forarr(x))
1248
1249Class ArrClass
1250 Dim classarr(3)
1251 Dim classnoarr()
1252 Dim var
1253
1254 Private Sub Class_Initialize
1255 Call ok(getVT(classarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(classarr) = " & getVT(classarr))
1256 Call testArray(-1, classnoarr)
1257 classarr(0) = 1
1258 classarr(1) = 2
1259 classarr(2) = 3
1260 classarr(3) = 4
1261 End Sub
1262
1263 Public Sub testVarVT
1264 Call ok(getVT(var) = "VT_ARRAY|VT_VARIANT*", "getVT(var) = " & getVT(var))
1265 End Sub
1266End Class
1267
1268Set obj = new ArrClass
1269Call ok(getVT(obj.classarr) = "VT_ARRAY|VT_VARIANT", "getVT(obj.classarr) = " & getVT(obj.classarr))
1270'todo_wine Call ok(obj.classarr(1) = 2, "obj.classarr(1) = " & obj.classarr(1))
1271
1272obj.var = arr
1273Call ok(getVT(obj.var) = "VT_ARRAY|VT_VARIANT", "getVT(obj.var) = " & getVT(obj.var))
1274Call obj.testVarVT
1275
1276Sub arrarg(byref refarr, byval valarr, byref refarr2, byval valarr2)
1277 Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr))
1278 Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr))
1279 Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2))
1280 Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2))
1281End Sub
1282
1283Call arrarg(arr, arr, obj.classarr, obj.classarr)
1284
1285Sub arrarg2(byref refarr(), byval valarr(), byref refarr2(), byval valarr2())
1286 Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr))
1287 Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr))
1288 Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2))
1289 Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2))
1290End Sub
1291
1292Call arrarg2(arr, arr, obj.classarr, obj.classarr)
1293
1294Sub testarrarg(arg(), vt)
1295 Call ok(getVT(arg) = vt, "getVT() = " & getVT(arg) & " expected " & vt)
1296End Sub
1297
1298Call testarrarg(1, "VT_I2*")
1299Call testarrarg(false, "VT_BOOL*")
1300Call testarrarg(Empty, "VT_EMPTY*")
1301
1302Sub modifyarr(arr)
1303 'Following test crashes on wine
1304 'Call ok(arr(0) = "not modified", "arr(0) = " & arr(0))
1305 arr(0) = "modified"
1306End Sub
1307
1308arr(0) = "not modified"
1309Call modifyarr(arr)
1310Call ok(arr(0) = "modified", "arr(0) = " & arr(0))
1311
1312arr(0) = "not modified"
1313modifyarr(arr)
1314Call todo_wine_ok(arr(0) = "not modified", "arr(0) = " & arr(0))
1315
1316for x = 0 to UBound(arr)
1317 arr(x) = x
1318next
1319y = 0
1320for each x in arr
1321 Call ok(x = y, "x = " & x & ", expected " & y)
1322 Call ok(arr(y) = y, "arr(" & y & ") = " & arr(y))
1323 arr(y) = 1
1324 x = 1
1325 y = y+1
1326next
1327Call ok(y = 4, "y = " & y & " after array enumeration")
1328
1329for x=0 to UBound(arr2, 1)
1330 for y=0 to UBound(arr2, 2)
1331 arr2(x, y) = x + y*(UBound(arr2, 1)+1)
1332 next
1333next
1334y = 0
1335for each x in arr2
1336 Call ok(x = y, "x = " & x & ", expected " & y)
1337 y = y+1
1338next
1339Call ok(y = 20, "y = " & y & " after array enumeration")
1340
1341for each x in noarr
1342 Call ok(false, "Empty array contains: " & x)
1343next
1344
1345' It's allowed to declare non-builtin RegExp class...
1346class RegExp
1347 public property get Global()
1348 Call ok(false, "Global called")
1349 Global = "fail"
1350 end property
1351end class
1352
1353' ...but there is no way to use it because builtin instance is always created
1354set x = new RegExp
1355Call ok(x.Global = false, "x.Global = " & x.Global)
1356
1357sub test_nothing_errors
1358 dim x
1359 on error resume next
1360
1361 x = 1
1362 err.clear
1363 x = nothing
1364 call ok(err.number = 91, "err.number = " & err.number)
1365 call ok(x = 1, "x = " & x)
1366
1367 err.clear
1368 x = not nothing
1369 call ok(err.number = 91, "err.number = " & err.number)
1370 call ok(x = 1, "x = " & x)
1371
1372 err.clear
1373 x = "" & nothing
1374 call ok(err.number = 91, "err.number = " & err.number)
1375 call ok(x = 1, "x = " & x)
1376end sub
1377call test_nothing_errors()
1378
1379sub test_identifiers
1380 ' test keywords that can also be a declared identifier
1381 Dim default
1382 default = "xx"
1383 Call ok(default = "xx", "default = " & default & " expected ""xx""")
1384
1385 Dim error
1386 error = "xx"
1387 Call ok(error = "xx", "error = " & error & " expected ""xx""")
1388
1389 Dim explicit
1390 explicit = "xx"
1391 Call ok(explicit = "xx", "explicit = " & explicit & " expected ""xx""")
1392
1393 Dim step
1394 step = "xx"
1395 Call ok(step = "xx", "step = " & step & " expected ""xx""")
1396end sub
1397call test_identifiers()
1398
1399sub test_dotIdentifiers
1400 ' test keywords that can also be an identifier after a dot
1401 ' Call ok(testObj.rem = 10, "testObj.rem = " & testObj.rem & " expected 10")
1402 Call ok(testObj.true = 10, "testObj.true = " & testObj.true & " expected 10")
1403 Call ok(testObj.false = 10, "testObj.false = " & testObj.false & " expected 10")
1404 Call ok(testObj.not = 10, "testObj.not = " & testObj.not & " expected 10")
1405 Call ok(testObj.and = 10, "testObj.and = " & testObj.and & " expected 10")
1406 Call ok(testObj.or = 10, "testObj.or = " & testObj.or & " expected 10")
1407 Call ok(testObj.xor = 10, "testObj.xor = " & testObj.xor & " expected 10")
1408 Call ok(testObj.eqv = 10, "testObj.eqv = " & testObj.eqv & " expected 10")
1409 Call ok(testObj.imp = 10, "testObj.imp = " & testObj.imp & " expected 10")
1410 Call ok(testObj.is = 10, "testObj.is = " & testObj.is & " expected 10")
1411 Call ok(testObj.mod = 10, "testObj.mod = " & testObj.mod & " expected 10")
1412 Call ok(testObj.call = 10, "testObj.call = " & testObj.call & " expected 10")
1413 Call ok(testObj.dim = 10, "testObj.dim = " & testObj.dim & " expected 10")
1414 Call ok(testObj.sub = 10, "testObj.sub = " & testObj.sub & " expected 10")
1415 Call ok(testObj.function = 10, "testObj.function = " & testObj.function & " expected 10")
1416 Call ok(testObj.get = 10, "testObj.get = " & testObj.get & " expected 10")
1417 Call ok(testObj.let = 10, "testObj.let = " & testObj.let & " expected 10")
1418 Call ok(testObj.const = 10, "testObj.const = " & testObj.const & " expected 10")
1419 Call ok(testObj.if = 10, "testObj.if = " & testObj.if & " expected 10")
1420 Call ok(testObj.else = 10, "testObj.else = " & testObj.else & " expected 10")
1421 Call ok(testObj.elseif = 10, "testObj.elseif = " & testObj.elseif & " expected 10")
1422 Call ok(testObj.end = 10, "testObj.end = " & testObj.end & " expected 10")
1423 Call ok(testObj.then = 10, "testObj.then = " & testObj.then & " expected 10")
1424 Call ok(testObj.exit = 10, "testObj.exit = " & testObj.exit & " expected 10")
1425 Call ok(testObj.while = 10, "testObj.while = " & testObj.while & " expected 10")
1426 Call ok(testObj.wend = 10, "testObj.wend = " & testObj.wend & " expected 10")
1427 Call ok(testObj.do = 10, "testObj.do = " & testObj.do & " expected 10")
1428 Call ok(testObj.loop = 10, "testObj.loop = " & testObj.loop & " expected 10")
1429 Call ok(testObj.until = 10, "testObj.until = " & testObj.until & " expected 10")
1430 Call ok(testObj.for = 10, "testObj.for = " & testObj.for & " expected 10")
1431 Call ok(testObj.to = 10, "testObj.to = " & testObj.to & " expected 10")
1432 Call ok(testObj.each = 10, "testObj.each = " & testObj.each & " expected 10")
1433 Call ok(testObj.in = 10, "testObj.in = " & testObj.in & " expected 10")
1434 Call ok(testObj.select = 10, "testObj.select = " & testObj.select & " expected 10")
1435 Call ok(testObj.case = 10, "testObj.case = " & testObj.case & " expected 10")
1436 Call ok(testObj.byref = 10, "testObj.byref = " & testObj.byref & " expected 10")
1437 Call ok(testObj.byval = 10, "testObj.byval = " & testObj.byval & " expected 10")
1438 Call ok(testObj.option = 10, "testObj.option = " & testObj.option & " expected 10")
1439 Call ok(testObj.nothing = 10, "testObj.nothing = " & testObj.nothing & " expected 10")
1440 Call ok(testObj.empty = 10, "testObj.empty = " & testObj.empty & " expected 10")
1441 Call ok(testObj.null = 10, "testObj.null = " & testObj.null & " expected 10")
1442 Call ok(testObj.class = 10, "testObj.class = " & testObj.class & " expected 10")
1443 Call ok(testObj.set = 10, "testObj.set = " & testObj.set & " expected 10")
1444 Call ok(testObj.new = 10, "testObj.new = " & testObj.new & " expected 10")
1445 Call ok(testObj.public = 10, "testObj.public = " & testObj.public & " expected 10")
1446 Call ok(testObj.private = 10, "testObj.private = " & testObj.private & " expected 10")
1447 Call ok(testObj.next = 10, "testObj.next = " & testObj.next & " expected 10")
1448 Call ok(testObj.on = 10, "testObj.on = " & testObj.on & " expected 10")
1449 Call ok(testObj.resume = 10, "testObj.resume = " & testObj.resume & " expected 10")
1450 Call ok(testObj.goto = 10, "testObj.goto = " & testObj.goto & " expected 10")
1451end sub
1452call test_dotIdentifiers
1453
1454' Test End statements not required to be preceeded by a newline or separator
1455Sub EndTestSub
1456 x = 1 End Sub
1457
1458Sub EndTestSubWithCall
1459 x = 1
1460 Call ok(x = 1, "x = " & x)End Sub
1461Call EndTestSubWithCall()
1462
1463Function EndTestFunc(x)
1464 Call ok(x > 0, "x = " & x)End Function
1465EndTestFunc(1)
1466
1467Class EndTestClassWithStorageId
1468 Public x End Class
1469
1470Class EndTestClassWithDim
1471 Dim x End Class
1472
1473Class EndTestClassWithFunc
1474 Function test(ByVal x)
1475 x = 0 End Function End Class
1476
1477Class EndTestClassWithProperty
1478 Public x
1479 Public default Property Get defprop
1480 defprop = x End Property End Class
1481
1482reportSuccess()