fusion: Implement IAssemblyCache::UninstallAssembly.
[wine/multimedia.git] / dlls / vbscript / tests / lang.vbs
blob1015e342b02eeb7359dda29546b219af4ce51fb9
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
21 dim x, y, z
23 call ok(true, "true is not true?")
24 ok true, "true is not true?"
25 call ok((true), "true is not true?")
27 ok not false, "not false but not true?"
28 ok not not true, "not not true but not true?"
30 Call ok(true = true, "true = true is false")
31 Call ok(false = false, "false = false is false")
32 Call ok(not (true = false), "true = false is true")
33 Call ok("x" = "x", """x"" = ""x"" is false")
34 Call ok(empty = empty, "empty = empty is false")
35 Call ok(empty = "", "empty = """" is false")
36 Call ok(0 = 0.0, "0 <> 0.0")
37 Call ok(16 = &h10&, "16 <> &h10&")
38 Call ok(010 = 10, "010 <> 10")
39 Call ok(10. = 10, "10. <> 10")
40 Call ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1")
41 Call ok(&hffFFffFF& = -1, "&hffFFffFF& <> -1")
42 Call ok(--1 = 1, "--1 = " & --1)
43 Call ok(-empty = 0, "-empty = " & (-empty))
44 Call ok(true = -1, "! true = -1")
45 Call ok(false = 0, "false <> 0")
46 Call ok(&hff = 255, "&hff <> 255")
47 Call ok(&Hff = 255, "&Hff <> 255")
49 x = "xx"
50 Call ok(x = "xx", "x = " & x & " expected ""xx""")
52 Call ok(true <> false, "true <> false is false")
53 Call ok(not (true <> true), "true <> true is true")
54 Call ok(not ("x" <> "x"), """x"" <> ""x"" is true")
55 Call ok(not (empty <> empty), "empty <> empty is true")
56 Call ok(x <> "x", "x = ""x""")
57 Call ok("true" <> true, """true"" = true is true")
59 Call ok("" = true = false, """"" = true = false is false")
60 Call ok(not(false = true = ""), "false = true = """" is true")
61 Call ok(not (false = false <> false = false), "false = false <> false = false is true")
62 Call ok(not ("" <> false = false), """"" <> false = false is true")
64 Call ok(getVT(false) = "VT_BOOL", "getVT(false) is not VT_BOOL")
65 Call ok(getVT(true) = "VT_BOOL", "getVT(true) is not VT_BOOL")
66 Call ok(getVT("") = "VT_BSTR", "getVT("""") is not VT_BSTR")
67 Call ok(getVT("test") = "VT_BSTR", "getVT(""test"") is not VT_BSTR")
68 Call ok(getVT(Empty) = "VT_EMPTY", "getVT(Empty) is not VT_EMPTY")
69 Call ok(getVT(null) = "VT_NULL", "getVT(null) is not VT_NULL")
70 Call ok(getVT(0) = "VT_I2", "getVT(0) is not VT_I2")
71 Call ok(getVT(1) = "VT_I2", "getVT(1) is not VT_I2")
72 Call ok(getVT(0.5) = "VT_R8", "getVT(0.5) is not VT_R8")
73 Call ok(getVT(0.0) = "VT_R8", "getVT(0.0) is not VT_R8")
74 Call ok(getVT(2147483647) = "VT_I4", "getVT(2147483647) is not VT_I4")
75 Call ok(getVT(2147483648) = "VT_R8", "getVT(2147483648) is not VT_R8")
76 Call ok(getVT(&h10&) = "VT_I2", "getVT(&h10&) is not VT_I2")
77 Call ok(getVT(&h10000&) = "VT_I4", "getVT(&h10000&) is not VT_I4")
78 Call ok(getVT(&H10000&) = "VT_I4", "getVT(&H10000&) is not VT_I4")
79 Call ok(getVT(&hffFFffFF&) = "VT_I2", "getVT(&hffFFffFF&) is not VT_I2")
80 Call ok(getVT(1 & 100000) = "VT_BSTR", "getVT(1 & 100000) is not VT_BSTR")
81 Call ok(getVT(-empty) = "VT_I2", "getVT(-empty) = " & getVT(-empty))
82 Call ok(getVT(-null) = "VT_NULL", "getVT(-null) = " & getVT(-null))
83 Call ok(getVT(y) = "VT_EMPTY*", "getVT(y) = " & getVT(y))
84 Call ok(getVT(nothing) = "VT_DISPATCH", "getVT(nothing) = " & getVT(nothing))
85 set x = nothing
86 Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x=nothing) = " & getVT(x))
87 x = true
88 Call ok(getVT(x) = "VT_BOOL*", "getVT(x) = " & getVT(x))
89 Call ok(getVT(false or true) = "VT_BOOL", "getVT(false) is not VT_BOOL")
90 x = "x"
91 Call ok(getVT(x) = "VT_BSTR*", "getVT(x) is not VT_BSTR*")
92 x = 0.0
93 Call ok(getVT(x) = "VT_R8*", "getVT(x) = " & getVT(x))
95 Call ok(isNullDisp(nothing), "nothing is not nulldisp?")
97 x = "xx"
98 Call ok("ab" & "cd" = "abcd", """ab"" & ""cd"" <> ""abcd""")
99 Call ok("ab " & null = "ab ", """ab"" & null = " & ("ab " & null))
100 Call ok("ab " & empty = "ab ", """ab"" & empty = " & ("ab " & empty))
101 Call ok(1 & 100000 = "1100000", "1 & 100000 = " & (1 & 100000))
102 Call ok("ab" & x = "abxx", """ab"" & x = " & ("ab"&x))
104 if(isEnglishLang) then
105 Call ok("" & true = "True", """"" & true = " & true)
106 Call ok(true & false = "TrueFalse", "true & false = " & (true & false))
107 end if
109 call ok(true and true, "true and true is not true")
110 call ok(true and not false, "true and not false is not true")
111 call ok(not (false and true), "not (false and true) is not true")
112 call ok(getVT(null and true) = "VT_NULL", "getVT(null and true) = " & getVT(null and true))
114 call ok(false or true, "false or uie is false?")
115 call ok(not (false or false), "false or false is not false?")
116 call ok(false and false or true, "false and false or true is false?")
117 call ok(true or false and false, "true or false and false is false?")
118 call ok(null or true, "null or true is false")
120 call ok(true xor false, "true xor false is false?")
121 call ok(not (false xor false), "false xor false is true?")
122 call ok(not (true or false xor true), "true or false xor true is true?")
123 call ok(not (true xor false or true), "true xor false or true is true?")
125 call ok(false eqv false, "false does not equal false?")
126 call ok(not (false eqv true), "false equals true?")
127 call ok(getVT(false eqv null) = "VT_NULL", "getVT(false eqv null) = " & getVT(false eqv null))
129 call ok(true imp true, "true does not imp true?")
130 call ok(false imp false, "false does not imp false?")
131 call ok(not (true imp false), "true imp false?")
132 call ok(false imp null, "false imp null is false?")
134 Call ok(2 >= 1, "! 2 >= 1")
135 Call ok(2 >= 2, "! 2 >= 2")
136 Call ok(not(true >= 2), "true >= 2 ?")
137 Call ok(2 > 1, "! 2 > 1")
138 Call ok(false > true, "! false < true")
139 Call ok(0 > true, "! 0 > true")
140 Call ok(not (true > 0), "true > 0")
141 Call ok(not (0 > 1 = 1), "0 > 1 = 1")
142 Call ok(1 < 2, "! 1 < 2")
143 Call ok(1 = 1 < 0, "! 1 = 1 < 0")
144 Call ok(1 <= 2, "! 1 <= 2")
145 Call ok(2 <= 2, "! 2 <= 2")
147 x = 3
148 Call ok(2+2 = 4, "2+2 = " & (2+2))
149 Call ok(false + 6 + true = 5, "false + 6 + true <> 5")
150 Call ok(getVT(2+null) = "VT_NULL", "getVT(2+null) = " & getVT(2+null))
151 Call ok(2+empty = 2, "2+empty = " & (2+empty))
152 Call ok(x+x = 6, "x+x = " & (x+x))
154 Call ok(5-1 = 4, "5-1 = " & (5-1))
155 Call ok(3+5-true = 9, "3+5-true <> 9")
156 Call ok(getVT(2-null) = "VT_NULL", "getVT(2-null) = " & getVT(2-null))
157 Call ok(2-empty = 2, "2-empty = " & (2-empty))
158 Call ok(2-x = -1, "2-x = " & (2-x))
160 Call ok(9 Mod 6 = 3, "9 Mod 6 = " & (9 Mod 6))
161 Call ok(11.6 Mod 5.5 = False, "11.6 Mod 5.5 = " & (11.6 Mod 5.5 = 0.6))
162 Call ok(7 Mod 4+2 = 5, "7 Mod 4+2 <> 5")
163 Call ok(getVT(2 mod null) = "VT_NULL", "getVT(2 mod null) = " & getVT(2 mod null))
164 Call ok(getVT(null mod 2) = "VT_NULL", "getVT(null mod 2) = " & getVT(null mod 2))
165 'FIXME: Call ok(empty mod 2 = 0, "empty mod 2 = " & (empty mod 2))
167 Call ok(5 \ 2 = 2, "5 \ 2 = " & (5\2))
168 Call ok(4.6 \ 1.5 = 2, "4.6 \ 1.5 = " & (4.6\1.5))
169 Call ok(4.6 \ 1.49 = 5, "4.6 \ 1.49 = " & (4.6\1.49))
170 Call ok(2+3\4 = 2, "2+3\4 = " & (2+3\4))
172 Call ok(2*3 = 6, "2*3 = " & (2*3))
173 Call ok(3/2 = 1.5, "3/2 = " & (3/2))
174 Call ok(5\4/2 = 2, "5\4/2 = " & (5\2/1))
175 Call ok(12/3\2 = 2, "12/3\2 = " & (12/3\2))
177 Call ok(2^3 = 8, "2^3 = " & (2^3))
178 Call ok(2^3^2 = 64, "2^3^2 = " & (2^3^2))
179 Call ok(-3^2 = 9, "-3^2 = " & (-3^2))
180 Call ok(2*3^2 = 18, "2*3^2 = " & (2*3^2))
182 x =_
187 x = 3
189 if true then y = true : x = y
190 ok x, "x is false"
192 x = true : if false then x = false
193 ok x, "x is false, if false called?"
195 if not false then x = true
196 ok x, "x is false, if not false not called?"
198 if not false then x = "test" : x = true
199 ok x, "x is false, if not false not called?"
201 if false then x = y : call ok(false, "if false .. : called")
203 if false then x = y : call ok(false, "if false .. : called") else x = "else"
204 Call ok(x = "else", "else not called?")
206 if true then x = y else y = x : Call ok(false, "in else?")
208 if false then :
210 if false then x = y : if true then call ok(false, "embedded if called")
212 if false then x=1 else x=2 end if
214 if false then
215 ok false, "if false called"
216 end if
218 x = true
219 if x then
220 x = false
221 end if
222 Call ok(not x, "x is false, if not evaluated?")
224 x = false
225 If false Then
226 Call ok(false, "inside if false")
227 Else
228 x = true
229 End If
230 Call ok(x, "else not called?")
232 x = false
233 If false Then
234 Call ok(false, "inside if false")
235 ElseIf not True Then
236 Call ok(false, "inside elseif not true")
237 Else
238 x = true
239 End If
240 Call ok(x, "else not called?")
242 x = false
243 If false Then
244 Call ok(false, "inside if false")
245 x = 1
246 y = 10+x
247 ElseIf not False Then
248 x = true
249 Else
250 Call ok(false, "inside else not true")
251 End If
252 Call ok(x, "elseif not called?")
254 x = false
255 If false Then
256 Call ok(false, "inside if false")
257 ElseIf not False Then
258 x = true
259 End If
260 Call ok(x, "elseif not called?")
262 x = false
263 y = false
264 while not (x and y)
265 if x then
266 y = true
267 end if
268 x = true
269 wend
270 call ok((x and y), "x or y is false after while")
272 while false
273 wend
275 x = false
276 y = false
277 do while not (x and y)
278 if x then
279 y = true
280 end if
281 x = true
282 loop
283 call ok((x and y), "x or y is false after while")
285 do while false
286 loop
288 do while true
289 exit do
290 ok false, "exit do didn't work"
291 loop
293 x = false
294 y = false
295 do until x and y
296 if x then
297 y = true
298 end if
299 x = true
300 loop
301 call ok((x and y), "x or y is false after do until")
303 do until true
304 loop
306 do until false
307 exit do
308 ok false, "exit do didn't work"
309 loop
311 x = false
312 y = false
314 if x then
315 y = true
316 end if
317 x = true
318 loop until x and y
319 call ok((x and y), "x or y is false after while")
322 loop until true
325 exit do
326 ok false, "exit do didn't work"
327 loop until false
329 x = false
330 y = false
332 if x then
333 y = true
334 end if
335 x = true
336 loop while not (x and y)
337 call ok((x and y), "x or y is false after while")
340 loop while false
343 exit do
344 ok false, "exit do didn't work"
345 loop while true
347 y = "for1:"
348 for x = 5 to 8
349 y = y & " " & x
350 next
351 Call ok(y = "for1: 5 6 7 8", "y = " & y)
353 y = "for2:"
354 for x = 5 to 8 step 2
355 y = y & " " & x
356 next
357 Call ok(y = "for2: 5 7", "y = " & y)
359 y = "for3:"
360 x = 2
361 for x = x+3 to 8
362 y = y & " " & x
363 next
364 Call ok(y = "for3: 5 6 7 8", "y = " & y)
366 y = "for4:"
367 for x = 5 to 4
368 y = y & " " & x
369 next
370 Call ok(y = "for4:", "y = " & y)
372 y = "for5:"
373 for x = 5 to 3 step true
374 y = y & " " & x
375 next
376 Call ok(y = "for5: 5 4 3", "y = " & y)
378 y = "for6:"
379 z = 4
380 for x = 5 to z step 3-4
381 y = y & " " & x
382 z = 0
383 next
384 Call ok(y = "for6: 5 4", "y = " & y)
386 y = "for7:"
387 z = 1
388 for x = 5 to 8 step z
389 y = y & " " & x
390 z = 2
391 next
392 Call ok(y = "for7: 5 6 7 8", "y = " & y)
394 y = "for8:"
395 for x = 5 to 8
396 y = y & " " & x
397 x = x+1
398 next
399 Call ok(y = "for8: 5 7", "y = " & y)
401 for x = 1.5 to 1
402 Call ok(false, "for..to called when unexpected")
403 next
405 for x = 1 to 100
406 exit for
407 Call ok(false, "exit for not escaped the loop?")
408 next
410 if false then
411 Sub testsub
412 x = true
413 End Sub
414 end if
416 x = false
417 Call testsub
418 Call ok(x, "x is false, testsub not called?")
420 Sub SubSetTrue(v)
421 Call ok(not v, "v is not true")
422 v = true
423 End Sub
425 x = false
426 SubSetTrue x
427 Call ok(x, "x was not set by SubSetTrue")
429 SubSetTrue false
430 Call ok(not false, "false is no longer false?")
432 Sub SubSetTrue2(ByRef v)
433 Call ok(not v, "v is not true")
434 v = true
435 End Sub
437 x = false
438 SubSetTrue2 x
439 Call ok(x, "x was not set by SubSetTrue")
441 Sub TestSubArgVal(ByVal v)
442 Call ok(not v, "v is not false")
443 v = true
444 Call ok(v, "v is not true?")
445 End Sub
447 x = false
448 Call TestSubArgVal(x)
449 Call ok(not x, "x is true after TestSubArgVal call?")
451 Sub TestSubMultiArgs(a,b,c,d,e)
452 Call ok(a=1, "a = " & a)
453 Call ok(b=2, "b = " & b)
454 Call ok(c=3, "c = " & c)
455 Call ok(d=4, "d = " & d)
456 Call ok(e=5, "e = " & e)
457 End Sub
459 Sub TestSubExit(ByRef a)
460 If a Then
461 Exit Sub
462 End If
463 Call ok(false, "Exit Sub not called?")
464 End Sub
466 Call TestSubExit(true)
468 TestSubMultiArgs 1, 2, 3, 4, 5
469 Call TestSubMultiArgs(1, 2, 3, 4, 5)
471 Sub TestSubLocalVal
472 x = false
473 Call ok(not x, "local x is not false?")
474 Dim x
475 Dim a,b, c
476 End Sub
478 x = true
479 y = true
480 Call TestSubLocalVal
481 Call ok(x, "global x is not true?")
483 Public Sub TestPublicSub
484 End Sub
485 Call TestPublicSub
487 Private Sub TestPrivateSub
488 End Sub
489 Call TestPrivateSub
491 if false then
492 Function testfunc
493 x = true
494 End Function
495 end if
497 x = false
498 Call TestFunc
499 Call ok(x, "x is false, testfunc not called?")
501 Function FuncSetTrue(v)
502 Call ok(not v, "v is not true")
503 v = true
504 End Function
506 x = false
507 FuncSetTrue x
508 Call ok(x, "x was not set by FuncSetTrue")
510 FuncSetTrue false
511 Call ok(not false, "false is no longer false?")
513 Function FuncSetTrue2(ByRef v)
514 Call ok(not v, "v is not true")
515 v = true
516 End Function
518 x = false
519 FuncSetTrue2 x
520 Call ok(x, "x was not set by FuncSetTrue")
522 Function TestFuncArgVal(ByVal v)
523 Call ok(not v, "v is not false")
524 v = true
525 Call ok(v, "v is not true?")
526 End Function
528 x = false
529 Call TestFuncArgVal(x)
530 Call ok(not x, "x is true after TestFuncArgVal call?")
532 Function TestFuncMultiArgs(a,b,c,d,e)
533 Call ok(a=1, "a = " & a)
534 Call ok(b=2, "b = " & b)
535 Call ok(c=3, "c = " & c)
536 Call ok(d=4, "d = " & d)
537 Call ok(e=5, "e = " & e)
538 End Function
540 TestFuncMultiArgs 1, 2, 3, 4, 5
541 Call TestFuncMultiArgs(1, 2, 3, 4, 5)
543 Function TestFuncLocalVal
544 x = false
545 Call ok(not x, "local x is not false?")
546 Dim x
547 End Function
549 x = true
550 y = true
551 Call TestFuncLocalVal
552 Call ok(x, "global x is not true?")
554 Function TestFuncExit(ByRef a)
555 If a Then
556 Exit Function
557 End If
558 Call ok(false, "Exit Function not called?")
559 End Function
561 Call TestFuncExit(true)
563 Sub SubParseTest
564 End Sub : x = false
565 Call SubParseTest
567 Function FuncParseTest
568 End Function : x = false
570 Function ReturnTrue
571 ReturnTrue = false
572 ReturnTrue = true
573 End Function
575 Call ok(ReturnTrue(), "ReturnTrue returned false?")
577 Function SetVal(ByRef x, ByVal v)
578 x = v
579 SetVal = x
580 Exit Function
581 End Function
583 x = false
584 ok SetVal(x, true), "SetVal returned false?"
585 Call ok(x, "x is not set to true by SetVal?")
587 Public Function TestPublicFunc
588 End Function
589 Call TestPublicFunc
591 Private Function TestPrivateFunc
592 End Function
593 Call TestPrivateFunc
595 ' Stop has an effect only in debugging mode
596 Stop
598 set x = testObj
599 Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x=testObj) = " & getVT(x))
601 Dim obj
602 Set obj = New EmptyClass
603 Call ok(getVT(obj) = "VT_DISPATCH*", "getVT(obj) = " & getVT(obj))
605 Class EmptyClass
606 End Class
608 Set x = obj
609 Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x) = " & getVT(x))
611 Class TestClass
612 Public publicProp
614 Private privateProp
616 Public Function publicFunction()
617 privateSub()
618 publicFunction = 4
619 End Function
621 Public Property Get gsProp()
622 gsProp = privateProp
623 funcCalled = "gsProp get"
624 exit property
625 Call ok(false, "exit property not returned?")
626 End Property
628 Public Default Property Get DefValGet
629 DefValGet = privateProp
630 funcCalled = "GetDefVal"
631 End Property
633 Public Property Let DefValGet(x)
634 End Property
636 Public publicProp2
638 Public Sub publicSub
639 End Sub
641 Public Property Let gsProp(val)
642 privateProp = val
643 funcCalled = "gsProp let"
644 exit property
645 Call ok(false, "exit property not returned?")
646 End Property
648 Public Property Set gsProp(val)
649 funcCalled = "gsProp set"
650 exit property
651 Call ok(false, "exit property not returned?")
652 End Property
654 Public Sub setPrivateProp(x)
655 privateProp = x
656 End Sub
658 Function getPrivateProp
659 getPrivateProp = privateProp
660 End Function
662 Private Sub privateSub
663 End Sub
665 Public Sub Class_Initialize
666 publicProp2 = 2
667 privateProp = true
668 End Sub
669 End Class
671 Call testDisp(new testClass)
673 Set obj = New TestClass
675 Call ok(obj.publicFunction = 4, "obj.publicFunction = " & obj.publicFunction)
676 Call ok(obj.publicFunction() = 4, "obj.publicFunction() = " & obj.publicFunction())
678 obj.publicSub()
679 Call obj.publicSub
680 Call obj.publicFunction()
682 Call ok(getVT(obj.publicProp) = "VT_EMPTY", "getVT(obj.publicProp) = " & getVT(obj.publicProp))
683 obj.publicProp = 3
684 Call ok(obj.publicProp = 3, "obj.publicProp = " & obj.publicProp)
685 obj.publicProp() = 3
687 Call ok(obj.getPrivateProp() = true, "obj.getPrivateProp() = " & obj.getPrivateProp())
688 Call obj.setPrivateProp(6)
689 Call ok(obj.getPrivateProp = 6, "obj.getPrivateProp = " & obj.getPrivateProp)
691 Dim funcCalled
692 funcCalled = ""
693 Call ok(obj.gsProp = 6, "obj.gsProp = " & obj.gsProp)
694 Call ok(funcCalled = "gsProp get", "funcCalled = " & funcCalled)
695 obj.gsProp = 3
696 Call ok(funcCalled = "gsProp let", "funcCalled = " & funcCalled)
697 Call ok(obj.getPrivateProp = 3, "obj.getPrivateProp = " & obj.getPrivateProp)
698 Set obj.gsProp = New testclass
699 Call ok(funcCalled = "gsProp set", "funcCalled = " & funcCalled)
701 x = obj
702 Call ok(x = 3, "(x = obj) = " & x)
703 Call ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled)
704 funcCalled = ""
705 Call ok(obj = 3, "(x = obj) = " & obj)
706 Call ok(funcCalled = "GetDefVal", "funcCalled = " & funcCalled)
708 Call obj.Class_Initialize
709 Call ok(obj.getPrivateProp() = true, "obj.getPrivateProp() = " & obj.getPrivateProp())
711 x = (New testclass).publicProp
713 Class TermTest
714 Public Sub Class_Terminate()
715 funcCalled = "terminate"
716 End Sub
717 End Class
719 Set obj = New TermTest
720 funcCalled = ""
721 Set obj = Nothing
722 Call ok(funcCalled = "terminate", "funcCalled = " & funcCalled)
724 Set obj = New TermTest
725 funcCalled = ""
726 Call obj.Class_Terminate
727 Call ok(funcCalled = "terminate", "funcCalled = " & funcCalled)
728 funcCalled = ""
729 Set obj = Nothing
730 Call ok(funcCalled = "terminate", "funcCalled = " & funcCalled)
732 Call (New testclass).publicSub()
733 Call (New testclass).publicSub
735 x = "following ':' is correct syntax" :
736 x = "following ':' is correct syntax" :: :
737 :: x = "also correct syntax"
738 rem another ugly way for comments
739 x = "rem as simplestatement" : rem rem comment
742 Set obj = new EmptyClass
743 Set x = obj
744 Set y = new EmptyClass
746 Call ok(obj is x, "obj is not x")
747 Call ok(x is obj, "x is not obj")
748 Call ok(not (obj is y), "obj is not y")
749 Call ok(not obj is y, "obj is not y")
750 Call ok(not (x is Nothing), "x is 1")
751 Call ok(Nothing is Nothing, "Nothing is not Nothing")
752 Call ok(x is obj and true, "x is obj and true is false")
754 Class TestMe
755 Public Sub Test(MyMe)
756 Call ok(Me is MyMe, "Me is not MyMe")
757 End Sub
758 End Class
760 Set obj = New TestMe
761 Call obj.test(obj)
763 Call ok(getVT(test) = "VT_DISPATCH", "getVT(test) = " & getVT(test))
764 Call ok(Me is Test, "Me is not Test")
766 Const c1 = 1, c2 = 2
767 Call ok(c1 = 1, "c1 = " & c1)
768 Call ok(getVT(c1) = "VT_I2", "getVT(c1) = " & getVT(c1))
770 if false then Const conststr = "str"
771 Call ok(conststr = "str", "conststr = " & conststr)
772 Call ok(getVT(conststr) = "VT_BSTR", "getVT(conststr) = " & getVT(conststr))
773 Call ok(conststr = "str", "conststr = " & conststr)
775 Sub ConstTestSub
776 Const funcconst = 1
777 Call ok(c1 = 1, "c1 = " & c1)
778 Call ok(funcconst = 1, "funcconst = " & funcconst)
779 End Sub
781 Call ConstTestSub
782 Dim funcconst
784 ' Property may be used as an identifier (although it's a keyword)
785 Sub TestProperty
786 Dim Property
787 PROPERTY = true
788 Call ok(property, "property = " & property)
790 for property = 1 to 2
791 next
792 End Sub
794 Call TestProperty
796 Class Property
797 Public Sub Property()
798 End Sub
800 Sub Test(byref property)
801 End Sub
802 End Class
804 Class Property2
805 Function Property()
806 End Function
809 Sub Test(property)
810 End Sub
812 Sub Test2(byval property)
813 End Sub
814 End Class
816 reportSuccess()