From 120c2150953f298f00f84c0f39dba2da99ec984c Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Tue, 27 Jan 2009 21:57:34 +0000 Subject: [PATCH] 2009-01-27 Zoltan Varga * TypeTest.cs: Add a test for #467229. svn path=/trunk/mcs/; revision=124718 --- mcs/class/corlib/Test/System/ChangeLog | 4 ++++ mcs/class/corlib/Test/System/TypeTest.cs | 30 +++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog index f0e3a78f536..7fbaacc6254 100644 --- a/mcs/class/corlib/Test/System/ChangeLog +++ b/mcs/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/mcs/class/corlib/Test/System/TypeTest.cs b/mcs/class/corlib/Test/System/TypeTest.cs index 1043eeb9e57..68e04f486ed 100644 --- a/mcs/class/corlib/Test/System/TypeTest.cs +++ b/mcs/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.25.1