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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Maurer <benm@mono-cvs.ximian.com>2003-12-22 19:49:33 +0300
committerBen Maurer <benm@mono-cvs.ximian.com>2003-12-22 19:49:33 +0300
commit056987c1927c608a3cdaa311a21c42adc702022a (patch)
tree34fd87a7493b0e21dddb57053a3199c26549808a /mcs/tests/test-221.cs
parent84a2ca4eef171714c375b1026c86f6407e009856 (diff)
2003-12-22 Ben Maurer <bmaurer@users.sourceforge.net>
* test-221.cs: Add some regression tests relating to 52408 (these dont test the actual bug, but regressions I created while writing the code for it). svn path=/trunk/mcs/; revision=21427
Diffstat (limited to 'mcs/tests/test-221.cs')
-rw-r--r--mcs/tests/test-221.cs86
1 files changed, 86 insertions, 0 deletions
diff --git a/mcs/tests/test-221.cs b/mcs/tests/test-221.cs
new file mode 100644
index 00000000000..ae8ff2ac032
--- /dev/null
+++ b/mcs/tests/test-221.cs
@@ -0,0 +1,86 @@
+//
+// Tests for bug # 52427 -- property inhertance stuff.
+// these tests are problems that cropped up while
+// making the patch. We dont want to regress on these.
+//
+
+class A { public virtual int Blah { get { return 1; } set {} } }
+
+class B : A {
+ public override int Blah { get { return 2; } }
+
+ public static bool Test ()
+ {
+ // Make sure we see that set in A
+
+ B b = new B ();
+
+ if (b.Blah != 2) return false;
+ if (b.Blah ++ != 2) return false;
+ b.Blah = 0;
+
+ return true;
+ }
+}
+
+abstract class C { public abstract int Blah { get; set; } }
+class D : C { public override int Blah { get { return 2; } set {} } }
+
+class E : D {
+ // Make sure we see that there is actually a base
+ // which we can call
+ public override int Blah { get { return base.Blah; } }
+
+ public static bool Test ()
+ {
+ E e = new E ();
+
+ if (e.Blah != 2) return false;
+ if (e.Blah ++ != 2) return false;
+ e.Blah = 2;
+
+ return true;
+ }
+}
+
+interface IBlah {
+ int this [int i] { get; set; }
+ int Blah { get; set; }
+}
+
+class F : IBlah {
+ int IBlah.this [int i] { get { return 1; } set {} }
+ int IBlah.Blah { get { return 1; } set {} }
+
+ public int this [int i] { get { return 2; } set {} }
+ public int Blah { get { return 2; } set {} }
+
+ public static bool Test ()
+ {
+ // Make sure we dont see a conflict between
+ // the explicit impl and the non interface version
+ F f = new F ();
+
+ if (f.Blah != 2) return false;
+ if (f.Blah ++ != 2) return false;
+ f.Blah = 2;
+
+
+ if (f [1] != 2) return false;
+ if (f [1] ++ != 2) return false;
+ f [1] = 2;
+
+ return true;
+ }
+}
+
+class Driver {
+ static int Main ()
+ {
+ if (! B.Test ()) return 1;
+ if (! E.Test ()) return 2;
+ if (! F.Test ()) return 3;
+
+ return 0;
+ }
+} \ No newline at end of file