Merge pull request #5675 from mono/glib-debug-symbols
[mono.git] / mcs / tests / test-debug-11.cs
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4
5 struct S : IDisposable, IEnumerable
6 {
7         public void Dispose ()
8         {
9         }
10         
11         public IEnumerator GetEnumerator ()
12         {
13                 return new List<int>().GetEnumerator (); 
14         }
15 }
16
17 class C
18 {
19         public static void Main ()
20         {
21         }
22
23         void Using_1 ()
24         {
25                 using (var s = new S ())
26                 {
27                 }
28         }
29         
30         void Using_2 ()
31         {
32                 using (S s = new S (), s2 = new S ())
33                 {
34                 }
35         }
36         
37         void Using_3 ()
38         {
39                 using (S? s = new S ())
40                 {
41                 }
42         }
43
44         void Using_4 ()
45         {
46                 using (var ms = new System.IO.MemoryStream ())
47                 {
48                         Console.WriteLine ("a");
49                 }
50         }
51         
52         void Lock ()
53         {
54                 lock (this)
55                 {
56                 }
57         }
58         
59         void Lock_2 ()
60         {
61                 lock (this)
62                 {
63                         return;
64                 }
65         }
66         
67         void Switch_1 (int arg)
68         {
69                 switch (arg)
70                 {
71                         case 1:
72                                 break;
73                         case 2:
74                         {
75                                 break;
76                         }
77                         case 3:
78                                 goto case 2;
79                         case 4:
80                         case 5:
81                                 break;
82                         default:
83                                 break;
84                 }
85         }
86         
87         void Switch_2 (int? arg)
88         {
89                 switch (arg)
90                 {
91                         case 1:
92                                 break;
93                         case 2:
94                         {
95                                 break;
96                         }
97                         default:
98                                 break;
99                 }
100         }
101         
102         void Switch_3 (string s)
103         {
104                 switch (s)
105                 {
106                         case "a":
107                                 break;
108                         case "b":
109                         {
110                                 break;
111                         }
112                         case "c":
113                         case "e":
114                                 goto case "a";
115                         case "f":
116                                 break;
117                         case "gggg":
118                         case "hhh":
119                         case "iii":
120                                 break;
121                         default:
122                                 break;
123                 }
124         }
125
126         void Switch_4 (string s)
127         {
128                 switch (s)
129                 {
130                         case "a":
131                                 break;
132                         case "b":
133                                 break;
134                         default:
135                                 break;
136                 }
137         }
138         
139         void Checked ()
140         {
141                 checked
142                 {
143                         int a = 1;
144                 }
145                 
146                 unchecked
147                 {
148                         int a = 2;
149                 }
150         }
151
152         void DoWhile (int arg)
153         {
154                 do
155                 {
156                 }
157                 while (arg != 0);
158                 
159                 while (arg > 0)
160                 {
161                 }
162         }
163         
164         void DoWhile_2 ()
165         {
166                 do
167                 {
168                         int i = 2;
169                 }
170                 while (true);
171         }
172
173         void While_2 ()
174         {
175                 while (true)
176                 {
177                         Console.WriteLine ("aa");
178                 }
179         }
180
181         void If (string s)
182         {
183                 if (s == "a")
184                 {
185                 }
186                 else
187                 {
188                 }
189         }
190         
191         void If_2 (string s)
192         {
193                 if (s == "a")
194                 {
195                 }
196                 else if (s == "b")
197                 {
198                 }
199                 else
200                 {
201                 }
202         }
203         
204         void If_3 (int i)
205         {
206                 if (i == i)
207                 {
208                 }
209                 else
210                 {
211                 }
212         }
213
214         void For_1 ()
215         {
216                 for (int i = 0;
217                 i < 4;
218                 ++i)
219                 {
220                 }
221                 
222                 for (;
223                 ;
224                 )
225                 {
226                 }
227         }
228         
229         void For_2 ()
230         {
231                 for (int i = 0; ;)
232                 {
233                 }
234         }
235         
236         void ForEach (int[] args)
237         {
238                 foreach (
239                 var a
240                 in args)
241                 {
242                 }
243         }
244         
245         void ForEach_2 (List<object> args)
246         {
247                 foreach
248                 (var a
249                 in
250                 args)
251                 {
252                 }
253         }
254
255         void ForEach_3 (S args)
256         {
257                 foreach
258                 (var a
259                 in
260                 args)
261                 {
262                 }
263         }
264         
265         void ForEach_4 (int[,] args)
266         {
267                 foreach (
268                 var a
269                 in args)
270                 {
271                 }
272         }
273 }