Update mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngPattern.cs
[mono.git] / mcs / tests / gtest-409.cs
1 using System;
2
3 //
4 // Parser conditional and cast expression tests
5 //
6
7 class A<T>
8 {
9         public static int Value;
10 }
11
12 public class ConditionalParsing
13 {
14         class T
15         {
16                 public T (string path, bool mode)
17                         : this (path, mode, (mode == true ? 1 : 2), 1, int.MaxValue)
18                 {
19                 }
20                 
21                 public T (string s, bool m, int i, int i2, int i3)
22                 {
23                 }
24         }
25         
26         class Const
27         {
28                 const int c = true ? 1 : 2;
29         }
30         
31         struct S
32         {
33         }
34         
35         void Test_1 (bool a)
36         {
37                 int? b = a ? 3 : 4;
38         }
39         
40         void Test_2 ()
41         {
42                 string mp = "";
43                 int a = 1;
44                 int _provider = mp.Length == a ? _provider = 4 : 5;
45         }
46         
47         T? Test_3<T> (Func<T, T, T> result, T t) where T : struct
48         {
49                 return new T? (result (t, t));
50         }
51         
52         void Test_4 (bool x, bool y)
53         {
54                 int s = x ? (y ? 2 : 4) : (y ? 5 : 7);
55         }
56         
57         void Test_5 (bool a, IDisposable fs)
58         {
59                 using (a ? fs : null) {
60                         Console.WriteLine ("");
61                 }
62         }
63         
64         void Test_6 (bool a)
65         {
66                 char[] escaped_text_chars =
67                         a != false ?
68                         new char [] {'&', '<', '>', '\r', '\n'} :
69                         new char [] {'&', '<', '>'};
70         }
71         
72         void Test_7 (object o)
73         {
74                 object a = (S?[]) o;
75         }
76
77         void Test_8 (DateTime value)
78         {
79                 var     _endDate = value > DateTime.MinValue ? new DateTime ? (value) : null;
80         }
81         
82         void Test_9 ()
83         {
84                 bool b = (1 == 2);
85                 bool c = (1 == 1);
86                 string a = (b ? (c ? "#" : "#") : "");
87         }
88
89         void Test_10 ()
90         {
91                 int i = new int [] { 1, 2, 3 } [1];
92         }
93         
94         void Test_11 ()
95         {
96                 int a = (int)(A<int>.Value);
97         }
98         
99         static int Test_12 (bool arg)
100         {
101                 return arg ? Foo (() => { return 1; }) : 1;
102         }
103         
104         static int Foo (Func<int> arg)
105         {
106                 return 1;
107         }
108
109         public static void Main ()
110         {
111         }
112 }
113