2009-05-26 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 26 May 2009 22:51:11 +0000 (22:51 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 26 May 2009 22:51:11 +0000 (22:51 -0000)
* TypeTest.cs: test for bug #506757.

svn path=/trunk/mcs/; revision=134811

mcs/class/corlib/Test/System/ChangeLog
mcs/class/corlib/Test/System/TypeTest.cs

index 1183b6fcd4e80e78a93ab2f6c8b5dfb7c633ad09..8f623242172aa4d1a50e08cb9b0a5691e4558bf3 100644 (file)
@@ -1,3 +1,7 @@
+2009-05-26 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * TypeTest.cs: test for bug #506757.
+
 2009-05-22  Zoltan Varga  <vargaz@gmail.com>
 
        * LazyTest.cs: New file.
index a79c722db43ec64ea032f2015ca76dd8ebf8845e..26248f7d8f518d52ae46e48363cd58f80f899997 100644 (file)
@@ -9,6 +9,7 @@
 
 using NUnit.Framework;
 using System;
+using System.Threading;
 using System.Collections;
 #if NET_2_0
 using System.Collections.Generic;
@@ -3158,6 +3159,51 @@ PublicKeyToken=b77a5c561934e089"));
                        Assert.AreEqual (t1, t2);
                }
 
+
+               [Test]
+               public void Bug506757 ()
+               {
+                       AssemblyName assemblyName = new AssemblyName ();
+                       assemblyName.Name = "customMod";
+                       assemblyName.Version = new Version (1, 2, 3, 4);
+       
+                       AssemblyBuilder assembly 
+                               = Thread.GetDomain().DefineDynamicAssembly(
+                                         assemblyName, AssemblyBuilderAccess.RunAndSave);
+       
+                       ModuleBuilder module = assembly.DefineDynamicModule("res.exe", "res.exe");
+       
+                       TypeBuilder type0 = module.DefineType ("Base", TypeAttributes.Public, typeof (object));
+                       TypeBuilder type1 = module.DefineType ("Middle", TypeAttributes.Public, type0);
+                       TypeBuilder type2 = module.DefineType ("End", TypeAttributes.Public, type1);
+       
+                       MethodAttributes attrs0 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
+                                                 MethodAttributes.NewSlot | MethodAttributes.FamORAssem;
+       
+                       MethodAttributes attrs1 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
+                                                 MethodAttributes.FamORAssem;
+       
+                       MethodAttributes attrs2 = MethodAttributes.Virtual | MethodAttributes.HideBySig |
+                                                 MethodAttributes.Public;
+       
+       
+                       MethodBuilder m0 = type0.DefineMethod ("Tst", attrs0, typeof (void), null);
+                       m0.GetILGenerator ().Emit (OpCodes.Ret);
+       
+                       MethodBuilder m1 = type1.DefineMethod ("Tst", attrs1, typeof (void), null);
+                       m1.GetILGenerator ().Emit (OpCodes.Ret);
+       
+                       MethodBuilder m2 = type2.DefineMethod ("Tst", attrs2, typeof (void), null);
+                       m2.GetILGenerator ().Emit (OpCodes.Ret);
+       
+       
+                       type0.CreateType ();
+                       type1.CreateType ();
+                       Type t2 = type2.CreateType ();
+       
+                       foreach (var m in t2.GetMethods (BindingFlags.Instance | BindingFlags.NonPublic))
+                               Assert.IsTrue (m.DeclaringType == typeof (object), String.Format ("{0}::{1}", m.DeclaringType, m.Name));
+               }
                static bool ContainsProperty (PropertyInfo [] props, string name)
                {
                        foreach (PropertyInfo p in props)