2010-06-21 Atsushi Enomoto <atsushi@ximian.com>
[mcs.git] / tests / gtest-409.cs
blobfb80a140fa5b6fae54d5db729cb6a596c63de861
1 using System;
3 //
4 // Parser conditional expression tests
5 //
7 public class ConditionalParsing
9 class T
11 public T (string path, bool mode)
12 : this (path, mode, (mode == true ? 1 : 2), 1, int.MaxValue)
16 public T (string s, bool m, int i, int i2, int i3)
21 class Const
23 const int c = true ? 1 : 2;
26 struct S
30 void Test_1 (bool a)
32 int? b = a ? 3 : 4;
35 void Test_2 ()
37 string mp = "";
38 int a = 1;
39 int _provider = mp.Length == a ? _provider = 4 : 5;
42 T? Test_3<T> (Func<T, T, T> result, T t) where T : struct
44 return new T? (result (t, t));
47 void Test_4 (bool x, bool y)
49 int s = x ? (y ? 2 : 4) : (y ? 5 : 7);
52 void Test_5 (bool a, IDisposable fs)
54 using (a ? fs : null) {
55 Console.WriteLine ("");
59 void Test_6 (bool a)
61 char[] escaped_text_chars =
62 a != false ?
63 new char [] {'&', '<', '>', '\r', '\n'} :
64 new char [] {'&', '<', '>'};
67 void Test_7 (object o)
69 object a = (S?[]) o;
72 void Test_8 (DateTime value)
74 var _endDate = value > DateTime.MinValue ? new DateTime ? (value) : null;
77 void Test_9 ()
79 bool b = (1 == 2);
80 bool c = (1 == 1);
81 string a = (b ? (c ? "#" : "#") : "");
84 void Test_10 ()
86 int i = new int [] { 1, 2, 3 } [1];
89 public static void Main ()