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

gtest-optional-04.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5cc5ecb5a61ebca01519590202d11d7038bf483e (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
using System;

public struct S
{
}

public class C
{
	static void Foo<T> (T t, T u = default (T))
	{
	}

	static void TestParams (params int[] i)
	{
		throw new ApplicationException ();
	}

	static void TestParams (int i = 4)
	{
	}

	static void TestParams2 (string s, params int[] i)
	{
		throw new ApplicationException ();
	}

	static void TestParams2 (string s, int i = 4)
	{
	}

	static void TestStruct (int? s = new int ())
	{
		if (!s.HasValue)
			throw new ApplicationException ("TestStruct");
	}
	
	static void TestStruct2 (S? s = new S? ())
	{
	}
	
	public string this [int i, string s = "test"] {
		get { return s; }
		set { value = s; }
	}

	public static int Main ()
	{
		Foo ("f");
		Foo (2);
		Foo (2, 4);
		Foo<long> (2);
		Foo<string> ("2", "3");
		
		TestParams ();
		TestParams2 ("a");
		
		TestStruct ();
		TestStruct2 ();
		
		C c = new C ();
		if (c [1] != "test")
			return 1;
		
		c [3] = "value";
		
		return 0;
	}
}