Browse Source

Fix CS73_StackAllocInitializer tests

pull/2542/head
Siegfried Pammer 4 years ago
parent
commit
b87cdf6bc4
  1. 10
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  2. 10
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS73_StackAllocInitializers.cs

10
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -79,6 +79,14 @@ namespace ICSharpCode.Decompiler.Tests @@ -79,6 +79,14 @@ namespace ICSharpCode.Decompiler.Tests
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslyn3OrNewerOptions =
{
CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.Optimize | CompilerOptions.UseRoslyn3_11_0,
CompilerOptions.UseRoslynLatest,
CompilerOptions.Optimize | CompilerOptions.UseRoslynLatest,
};
static readonly CompilerOptions[] roslynLatestOnlyOptions =
{
CompilerOptions.UseRoslynLatest,
@ -440,7 +448,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -440,7 +448,7 @@ namespace ICSharpCode.Decompiler.Tests
}
[Test]
public void CS73_StackAllocInitializers([ValueSource(nameof(roslynLatestOnlyOptions))] CompilerOptions cscOptions)
public void CS73_StackAllocInitializers([ValueSource(nameof(roslyn3OrNewerOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
}

10
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CS73_StackAllocInitializers.cs

@ -193,11 +193,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -193,11 +193,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public unsafe string NegativeOffsets(int a, int b, int c)
{
#if OPT
byte* intPtr = stackalloc byte[12];
*(int*)intPtr = 1;
*(int*)(intPtr - 4) = 2;
*(int*)(intPtr - 8) = 3;
int* ptr = (int*)intPtr;
byte* num = stackalloc byte[12];
*(int*)num = 1;
*(int*)(num - 4) = 2;
*(int*)(num - 8) = 3;
int* ptr = (int*)num;
Console.WriteLine(*ptr);
return UsePointer((byte*)ptr);
#else

Loading…
Cancel
Save