From 68de0d3d0d6e0b934538964c13e7c6ab4e5b206f Mon Sep 17 00:00:00 2001 From: zoltan Date: Tue, 27 Jan 2009 21:57:34 +0000 Subject: [PATCH] 2009-01-27 Zoltan Varga * TypeTest.cs: Add a test for #467229. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@124718 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- class/corlib/Test/System/ChangeLog | 4 ++++ class/corlib/Test/System/TypeTest.cs | 30 +++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/class/corlib/Test/System/ChangeLog b/class/corlib/Test/System/ChangeLog index f0e3a78f53..7fbaacc625 100644 --- a/class/corlib/Test/System/ChangeLog +++ b/class/corlib/Test/System/ChangeLog @@ -1,3 +1,7 @@ +2009-01-27 Zoltan Varga + + * TypeTest.cs: Add a test for #467229. + 2009-01-06 Atsushi Enomoto * DateTimeTest.cs : added test for parsing no-millisecond time diff --git a/class/corlib/Test/System/TypeTest.cs b/class/corlib/Test/System/TypeTest.cs index 1043eeb9e5..68e04f486e 100644 --- a/class/corlib/Test/System/TypeTest.cs +++ b/class/corlib/Test/System/TypeTest.cs @@ -3062,6 +3062,20 @@ PublicKeyToken=b77a5c561934e089")); Assert.AreEqual(1, tArgs[1].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1"); Assert.AreEqual(1, mArgs[0].GetCustomAttributes (typeof (DocAttribute), true).Length, "#1"); } + + [Test] + public void EqualsUserType () { + UserType2 t1 = new UserType2(null); + UserType2 t2 = new UserType2(t1); + Assert.IsTrue (t1.Equals(t2)); + } + + [Test] + public void GetHashCodeUserType () { + UserType2 t1 = new UserType2(null); + UserType2 t2 = new UserType2(t1); + Assert.AreEqual (42, t2.GetHashCode()); + } #endif [Test] @@ -3416,7 +3430,7 @@ PublicKeyToken=b77a5c561934e089")); #if NET_2_0 class UserType : Type { - private Type type; + protected Type type; public UserType(Type type) { this.type = type; @@ -3591,5 +3605,19 @@ PublicKeyToken=b77a5c561934e089")); throw new NotSupportedException(); } } + + class UserType2 : UserType { + public UserType2 (Type type) : base (type) { + } + + public override Type UnderlyingSystemType { get { return this.type ?? this; } } + + public override int GetHashCode() + { + if (type == null) + return 42; + return type.GetHashCode(); + } + } #endif } -- 2.11.4.GIT