Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-409.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 606ae3685d1462432300edfd7cf4ea8ddd15dff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// Compiler options: -langversion:latest
using System;

//
// parser conditional and cast expression tests
//

class A<T>
{
	public static int Value;
}

public class ConditionalParsing
{
	class T
	{
		public T (string path, bool mode)
			: this (path, mode, (mode == true ? 1 : 2), 1, int.MaxValue)
		{
		}
		
		public T (string s, bool m, int i, int i2, int i3)
		{
		}
	}
	
	class Const
	{
		const int c = true ? 1 : 2;
	}
	
	struct S
	{
	}

	struct MyTestStruct : IDisposable
	{
		public void Dispose ()
		{
		}

		public static implicit operator MyTestStruct (int i)
		{
			return new MyTestStruct ();
		}
	}
	
	void Test_1 (bool a)
	{
		int? b = a ? 3 : 4;
	}
	
	void Test_2 ()
	{
		string mp = "";
		int a = 1;
		int _provider = mp.Length == a ? _provider = 4 : 5;
	}
	
	T? Test_3<T> (Func<T, T, T> result, T t) where T : struct
	{
		return new T? (result (t, t));
	}
	
	void Test_4 (bool x, bool y)
	{
		int s = x ? (y ? 2 : 4) : (y ? 5 : 7);
	}
	
	void Test_5 (bool a, IDisposable fs)
	{
		using (a ? fs : null) {
			Console.WriteLine ("");
		}
	}
	
	void Test_6 (bool a)
	{
		char[] escaped_text_chars =
			a != false ?
			new char [] {'&', '<', '>', '\r', '\n'} :
			new char [] {'&', '<', '>'};
	}
	
	void Test_7 (object o)
	{
		object a = (S?[]) o;
	}

	void Test_8 (DateTime value)
	{
		var	_endDate = value > DateTime.MinValue ? new DateTime ? (value) : null;
	}
	
	void Test_9 ()
	{
		bool b = (1 == 2);
		bool c = (1 == 1);
		string a = (b ? (c ? "#" : "#") : "");
	}

	void Test_10 ()
	{
		int i = new int [] { 1, 2, 3 } [1];
	}
	
	void Test_11 ()
	{
		int a = (int)(A<int>.Value);
	}
	
	static int Test_12 (bool arg)
	{
		return arg ? Foo (() => { return 1; }) : 1;
	}
	
	static int Foo (Func<int> arg)
	{
		return 1;
	}

	void Test_13 (object param)
	{
		if (param as bool? ?? false) {} else {}
	}

	int? Test_14 ()
	{
		bool a = false, b = false;
		object c = null;

		return a ? (b ? c as int? : null) : null;
	}

	Action<int> Test_15 (Action<int> arg)
	{
		return arg ?? (Helper<int>);
	}

	void Test_16 ()
	{
		bool? b = Test (1, arg:2);
	}

	void Test_17 ()
	{
		{
			using (MyTestStruct? mts = (int?) 1)
			{
			}
		}
	}

	void Test_18 (bool b, Action a)
	{
		var e = b ? () => { } : a;
	}

	void Test_19 (int[,] table)
	{
		var x = 1 > 0  ? table[5, 1] : 0;
	}

	void Test_20 ()
	{
		var t = (Object)string.Empty;
	}

	void Test_21 ()
	{
		var t = (Int32)sbyte.MaxValue;
	}

	void Test_22 (bool args)
	{
		var x = args ?.2f : -.2f;
	}

	void Test_23 (string args)
	{
		var x = args == null ? default : 1;
	}

	static void Helper<T> (T arg)
	{
	}

	static bool Test (object b, int arg)
	{
		return false;
	}

	public static void Main ()
	{
	}
}