Skip to content

Commit 9d02188

Browse files
Delete test testing a weird delegate implementation detail (dotnet#102647)
Apparently on CoreCLR delegates pointing to different static methods on the same type have the same HashCode. It doesn't sound like something that should be enshrined in tests. Putting this out in a separate PR to potentially get more eyes on this.
1 parent a7386e0 commit 9d02188

File tree

1 file changed

+0
-67
lines changed

1 file changed

+0
-67
lines changed

src/tests/CoreMangLib/system/delegate/delegate/delegategethashcode1.cs

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public bool RunTests()
4343
retVal = PosTest1() && retVal;
4444
retVal = PosTest2() && retVal;
4545
retVal = PosTest3() && retVal;
46-
retVal = PosTest4() && retVal;
47-
retVal = PosTest6() && retVal;
4846
retVal = PosTest7() && retVal;
4947
retVal = PosTest8() && retVal;
5048
return retVal;
@@ -150,71 +148,6 @@ public bool PosTest3()
150148
// Returns true if the expected result is right
151149
// Returns false if the expected result is wrong
152150
// the same delegate object is booldelegate
153-
public bool PosTest4()
154-
{
155-
bool retVal = true;
156-
157-
TestLibrary.TestFramework.BeginScenario("PosTest4: Use the same type's different static method to create two delegate which delegate object is the same,their hashcode is equal ");
158-
159-
try
160-
{
161-
DelegateGetHashCode delctor = new DelegateGetHashCode();
162-
booldelegate workDelegate1= new booldelegate(TestClass.Working_Bool);
163-
booldelegate workDelegate = new booldelegate(TestClass.Completed_Bool);
164-
if (workDelegate.GetHashCode() != workDelegate1.GetHashCode())
165-
{
166-
TestLibrary.TestFramework.LogError("007", "HashCode is not excepted ");
167-
retVal = false;
168-
}
169-
170-
workDelegate();
171-
workDelegate1();
172-
173-
}
174-
catch (Exception e)
175-
{
176-
TestLibrary.TestFramework.LogError("008", "Unexpected exception: " + e);
177-
retVal = false;
178-
}
179-
180-
return retVal;
181-
}
182-
// Returns true if the expected result is right
183-
// Returns false if the expected result is wrong
184-
// the same delegate object is booldelegate
185-
public bool PosTest6()
186-
{
187-
bool retVal = true;
188-
189-
TestLibrary.TestFramework.BeginScenario("PosTest6: Use the different type's same static method to create two delegate ,which delegate object is the same,their hashcode is equal");
190-
191-
try
192-
{
193-
DelegateGetHashCode delctor = new DelegateGetHashCode();
194-
booldelegate workDelegate = new booldelegate(TestClass.Completed_Bool);
195-
booldelegate workDelegate1 = new booldelegate(TestClass1.Completed_Bool);
196-
197-
if (workDelegate.GetHashCode()!=workDelegate1.GetHashCode())
198-
{
199-
TestLibrary.TestFramework.LogError("011", "HashCode is not excepted");
200-
retVal = false;
201-
}
202-
203-
workDelegate();
204-
workDelegate1();
205-
206-
}
207-
catch (Exception e)
208-
{
209-
TestLibrary.TestFramework.LogError("012", "Unexpected exception: " + e);
210-
retVal = false;
211-
}
212-
213-
return retVal;
214-
}
215-
// Returns true if the expected result is right
216-
// Returns false if the expected result is wrong
217-
// the same delegate object is booldelegate
218151
public bool PosTest7()
219152
{
220153
bool retVal = true;

0 commit comments

Comments
 (0)