2003-12-22 Ben Maurer <bmaurer@users.sourceforge.net>
authorBen Maurer <benm@mono-cvs.ximian.com>
Mon, 22 Dec 2003 16:49:33 +0000 (16:49 -0000)
committerBen Maurer <benm@mono-cvs.ximian.com>
Mon, 22 Dec 2003 16:49:33 +0000 (16:49 -0000)
* 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

mcs/tests/ChangeLog
mcs/tests/Makefile
mcs/tests/README.tests
mcs/tests/test-221.cs [new file with mode: 0644]

index dfb3e5c62ad0d62beb90ff39bcf917a4e2910f16..4b47e4be4e8e2b57b71561f846305bbf8789acbb 100755 (executable)
@@ -1,3 +1,9 @@
+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).
+
 2003-12-20  Zoltan Varga  <vargaz@freemail.hu>
 
        * module-1.cs module-2.cs module-3.cs: New files.
index d084961120bd910e028ae47aa75f3f682e58ad32..7b5fe5a72442ef853e49964d3fe83efba574571f 100644 (file)
@@ -34,7 +34,8 @@ TEST_SOURCES = \
        test-181 test-182 test-183 test-184 test-185 test-186 test-187 test-188 test-189 test-190 \
        test-191 test-192 test-193 test-194 test-195 test-196 test-197 test-198 test-199 test-200 \
        test-201 test-202 test-203 test-204 test-205 test-206 test-207 test-208 test-209 test-210 \
-       test-211 test-212 test-213 test-214 test-215 test-216 test-217 test-218 test-219 test-220
+       test-211 test-212 test-213 test-214 test-215 test-216 test-217 test-218 test-219 test-220 \
+       test-221
 
 #
 # C# 2.0 tests 
index 9915a34e2c464df8de6bc687abb3a57f4e3f8e8f..422fb7c3508ebb063c29c3bc51772b292962b402 100644 (file)
@@ -15,7 +15,7 @@ Test cases listed by Category:
 
 * Indexers and Properties
 
-  test-148.cs test-166.cs test-206.cs test-208.cs test-209.cs
+  test-148.cs test-166.cs test-206.cs test-208.cs test-209.cs test-221.cs
 
 * Events and Delegates
 
@@ -404,6 +404,10 @@ test-220.cs:
 Test for a bug in foreach, where it would pick the wrong GetEnumerator in a class.
 Bug # was 51446
 
+test-221.cs:
+------------
+Test for correct scanning for base properties.
+
 verify-1.cs
 -----------
 Test whether we do not jump out of the method in a Try/Finally block.
diff --git a/mcs/tests/test-221.cs b/mcs/tests/test-221.cs
new file mode 100644 (file)
index 0000000..ae8ff2a
--- /dev/null
@@ -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