Skip to content

Commit d53b4b2

Browse files
AndyAyersMSgithub-actions
authored andcommitted
revise tests to not hard code the name of the enumerator type
1 parent c97cea2 commit d53b4b2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/tests/JIT/Regression/JitBlue/Runtime_120270/Runtime_120270.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,23 @@ static void Foo<T>(object[] x)
7171
[Fact]
7272
public static int TestEntryPoint3()
7373
{
74+
Type enumeratorType = null;
7475
for (int i = 0; i < 100_000; i++)
7576
{
7677
Derived[] d = [new Derived()];
7778
IEnumerable<Base> e = d;
7879
IEnumerator<Base> en = e.GetEnumerator();
79-
string s = en.GetType().ToString();
80+
Type currentEnumeratorType = en.GetType();
8081

8182
if (i == 0)
8283
{
83-
Console.WriteLine($"Enumerator type: {s}");
84+
Console.WriteLine($"Enumerator type: {currentEnumeratorType.ToString()}");
85+
enumeratorType = currentEnumeratorType;
8486
}
8587

86-
if (!s.Equals("System.SZGenericArrayEnumerator`1[Base]"))
88+
if (enumeratorType != currentEnumeratorType)
8789
{
88-
Console.WriteLine($"Enumerator type changed at {i} to {s}");
90+
Console.WriteLine($"Enumerator type changed at {i} from {enumeratorType.ToString()} to {currentEnumeratorType.ToString()}");
8991
return -1;
9092
}
9193
}

0 commit comments

Comments
 (0)