Browse Source

mcs 5 generates IL patterns that might lead to wrong behavior, if inlined, therefore we have to add another special case to the tests.

pull/2546/head
Siegfried Pammer 4 years ago
parent
commit
7c7ce6f6c7
  1. 8
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  2. 12
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs

8
ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

@ -340,6 +340,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
else if ((flags & CompilerOptions.UseMcsMask) != 0) else if ((flags & CompilerOptions.UseMcsMask) != 0)
{ {
preprocessorSymbols.Add("MCS"); preprocessorSymbols.Add("MCS");
if (flags.HasFlag(CompilerOptions.UseMcs2_6_4))
{
preprocessorSymbols.Add("MCS2");
}
if (flags.HasFlag(CompilerOptions.UseMcs5_23))
{
preprocessorSymbols.Add("MCS5");
}
} }
else else
{ {

12
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs

@ -507,7 +507,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public void ForEachBreakWhenFound(string name, ref StringComparison output) public void ForEachBreakWhenFound(string name, ref StringComparison output)
{ {
#if MCS #if MCS2
foreach (int value in Enum.GetValues(typeof(StringComparison))) foreach (int value in Enum.GetValues(typeof(StringComparison)))
{ {
if (((StringComparison)value).ToString() == name) if (((StringComparison)value).ToString() == name)
@ -516,6 +516,16 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
break; break;
} }
} }
#elif MCS5
foreach (int value in Enum.GetValues(typeof(StringComparison)))
{
StringComparison stringComparison = (StringComparison)value;
if (stringComparison.ToString() == name)
{
output = (StringComparison)value;
break;
}
}
#else #else
foreach (StringComparison value in Enum.GetValues(typeof(StringComparison))) foreach (StringComparison value in Enum.GetValues(typeof(StringComparison)))
{ {

Loading…
Cancel
Save