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

test-724.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d4ca16add968b18f07622421a6eb80c05761b57b (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
public class Test
{
	private static int DoTest (string type, string expected, string actual, int failcode)
	{
		if (!actual.Equals (expected)) {
			System.Console.WriteLine ("Bad {0}: Expected {1}, Was {2}",
							   type, expected, actual);
			return failcode;
		}
		return 0;
	}

	public static int Main ()
	{
		int failure = 0;
		Concrete val = new Concrete ();

		failure |= DoTest ("A", "A", ((A) val).Spec, 0x01);
		failure |= DoTest ("B", "B", ((B) val).Spec, 0x02);
		failure |= DoTest ("C", "B", ((C) val).Spec, 0x04);
		failure |= DoTest ("Concrete", "Concrete", val.Spec, 0x08);

		return failure;
	}
}

interface A
{
	string Spec { get; }
}

interface B : A
{
	new string Spec { get; }
}

interface C : B
{
}

class Concrete : C
{
	string A.Spec { get { return "A"; } }
	string B.Spec { get { return "B"; } }
	public string Spec { get { return "Concrete"; } }
}