(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / mbas / Test / tests / OptionalA.vb
blobc18306980a3b36ac1af21caa796371dc828a06b6
1 Imports System
3 Module Test
4 Enum E
7 End Enum
8 Function F(Optional i As Integer = 42) As Integer
9 F = i + 1
10 End Function
11 Function F2(ByVal Optional i As Integer = 42) As Integer
12 F2 = i + 1
13 End Function
14 Function G(i As Integer, Optional j As Integer = 42) As Integer
15 G = i + j
16 End Function
17 Function G(e As E) As Integer
18 G = e
19 End Function
20 Function H(i As Integer, Optional j As Integer = 42, Optional k As Integer = 3) As Integer
21 H = i + j + k
22 End Function
23 Function K(ByRef Optional i As Integer = 3) As Integer
24 K = i
25 i = i + 3
26 End Function
27 Sub Main
28 If F() <> 43 Then
29 Throw New Exception("#A1: unexpected return value")
30 End If
31 If F(99) <> 100 Then
32 Throw New Exception("#A2: unexpected return value")
33 End If
34 If F2() <> 43 Then
35 Throw New Exception("#A3: unexpected return value")
36 End If
37 If G(1) <> 43 Then
38 Throw New Exception("#A4: unexpected return value")
39 End If
40 If G(E.A) <> 0 Then
41 Throw New Exception("#A5: unexpected return value")
42 End If
43 If G(1,99) <> 100 Then
44 Throw New Exception("#A6: unexpected return value")
45 End If
46 If G(E.A,99) <> 99 Then
47 Throw New Exception("#A7: unexpected return value")
48 End If
49 If H(1) <> 46 Then
50 Throw New Exception("#A8: unexpected return value")
51 End If
52 If H(1,0) <> 4 Then
53 Throw New Exception("#A9: unexpected return value")
54 End If
55 If H(E.A) <> 45 Then
56 Throw New Exception("#A10: unexpected return value")
57 End If
58 If K() <> 3 Then
59 Throw New Exception("#A11: unexpected return value")
60 End If
61 Dim i As Integer = 9
62 If K(i) <> 9 OrElse i <> 12 Then
63 Throw New Exception("#A12: unexpected return value")
64 End If
65 End Sub
66 End Module