Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / base-definition.cs
1 using System;
2 using System.Reflection;
3
4 abstract class test
5 {
6         public static int Main ()
7         {
8                 MethodInfo m = typeof (SubTestClass).GetMethod ("get_name");
9                 MethodInfo bm = m.GetBaseDefinition ();
10                 if (bm == null || bm.DeclaringType != typeof (TestClass) || bm.Name != "get_name") return 1;
11
12                 m = typeof (SubTestClass).GetMethod ("get_name2");
13                 bm = m.GetBaseDefinition ();
14                 if (bm == null || bm.DeclaringType != typeof (TestClass) || bm.Name != "get_name2") return 2;
15
16                 m = typeof (SubTestClass).GetMethod ("get_name3");
17                 bm = m.GetBaseDefinition ();
18                 if (bm == null || bm.DeclaringType != typeof (BaseTestClass) || bm.Name != "get_name3") return 3;
19                 
20                 return 0;
21         }
22 }
23
24 abstract class BaseTestClass
25 {
26         public abstract string name3
27         {
28                 get;
29         }
30
31 }
32
33 abstract class TestClass : BaseTestClass
34 {
35         public abstract string name
36         {
37                 get;
38         }
39
40         public virtual string name2
41         {
42                 get { return null; }
43         }
44 }
45
46 class SubTestClass : TestClass
47 {
48         public override string name
49         {
50                 get { return ""; }
51         }
52
53         public override string name2
54         {
55                 get { return ""; }
56         }
57
58         public override string name3
59         {
60                 get { return ""; }
61         }
62 }
63
64