7605b604d51cb1e4d8f88887c876e3d89e9e8a03
[mono.git] / mcs / tests / gtest-409.cs
1 using System;
2
3 //
4 // Parser conditional expression tests
5 //
6
7 public class ConditionalParsing
8 {
9         class T
10         {
11                 public T (string path, bool mode)
12                         : this (path, mode, (mode == true ? 1 : 2), 1, int.MaxValue)
13                 {
14                 }
15                 
16                 public T (string s, bool m, int i, int i2, int i3)
17                 {
18                 }
19         }
20         
21         class Const
22         {
23                 const int c = true ? 1 : 2;
24         }
25         
26         struct S
27         {
28         }
29         
30         void Test_1 (bool a)
31         {
32                 int? b = a ? 3 : 4;
33         }
34         
35         void Test_2 ()
36         {
37                 string mp = "";
38                 int a = 1;
39                 int _provider = mp.Length == a ? _provider = 4 : 5;
40         }
41         
42         T? Test_3<T> (Func<T, T, T> result, T t) where T : struct
43         {
44                 return new T? (result (t, t));
45         }
46         
47         void Test_4 (bool x, bool y)
48         {
49                 int s = x ? (y ? 2 : 4) : (y ? 5 : 7);
50         }
51         
52         void Test_5 (bool a, IDisposable fs)
53         {
54                 using (a ? fs : null) {
55                         Console.WriteLine ("");
56                 }
57         }
58         
59         void Test_6 (bool a)
60         {
61                 char[] escaped_text_chars =
62                         a != false ?
63                         new char [] {'&', '<', '>', '\r', '\n'} :
64                         new char [] {'&', '<', '>'};
65         }
66         
67         void Test_7 (object o)
68         {
69                 object a = (S?[]) o;
70         }
71
72         public static void Main ()
73         {
74         }
75 }
76