mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-12 02:15:58 +00:00
Add tests
This commit is contained in:
@@ -73,6 +73,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
CheckForOverflowUnderflow = 0x20000,
|
||||
ProcessXmlDoc = 0x40000,
|
||||
UseRoslyn4_14_0 = 0x80000,
|
||||
EnableRuntimeAsync = 0x100000,
|
||||
UseMcsMask = UseMcs2_6_4 | UseMcs5_23,
|
||||
UseRoslynMask = UseRoslyn1_3_2 | UseRoslyn2_10_0 | UseRoslyn3_11_0 | UseRoslyn4_14_0 | UseRoslynLatest
|
||||
}
|
||||
@@ -605,13 +606,18 @@ namespace System.Runtime.CompilerServices
|
||||
if (roslynVersion != "legacy")
|
||||
{
|
||||
otherOptions += "/shared ";
|
||||
if (!targetNet40 && Version.Parse(RoslynToolset.SanitizeVersion(roslynVersion)).Major > 2)
|
||||
var version = Version.Parse(RoslynToolset.SanitizeVersion(roslynVersion));
|
||||
if (!targetNet40 && version.Major > 2)
|
||||
{
|
||||
if (flags.HasFlag(CompilerOptions.NullableEnable))
|
||||
otherOptions += "/nullable+ ";
|
||||
else
|
||||
otherOptions += "/nullable- ";
|
||||
}
|
||||
if (!targetNet40 && roslynVersion == roslynLatestVersion && flags.HasFlag(CompilerOptions.EnableRuntimeAsync))
|
||||
{
|
||||
otherOptions += "/features:runtime-async=on ";
|
||||
}
|
||||
}
|
||||
|
||||
if (flags.HasFlag(CompilerOptions.Library))
|
||||
|
||||
@@ -537,6 +537,46 @@ namespace ICSharpCode.Decompiler.Tests
|
||||
await RunForLibrary(cscOptions: cscOptions);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RuntimeAsync([ValueSource(nameof(roslyn5OrNewerOptions))] CompilerOptions cscOptions)
|
||||
{
|
||||
await RunForLibrary("Async", cscOptions: cscOptions | CompilerOptions.EnableRuntimeAsync | CompilerOptions.Preview);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RuntimeAsyncForeach([ValueSource(nameof(roslyn5OrNewerOptions))] CompilerOptions cscOptions)
|
||||
{
|
||||
await RunForLibrary("AsyncForeach", cscOptions: cscOptions | CompilerOptions.EnableRuntimeAsync | CompilerOptions.Preview | CompilerOptions.GeneratePdb);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RuntimeAsyncMain([ValueSource(nameof(roslyn5OrNewerOptions))] CompilerOptions cscOptions)
|
||||
{
|
||||
await Run("AsyncMain", cscOptions: cscOptions | CompilerOptions.EnableRuntimeAsync | CompilerOptions.Preview);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RuntimeAsyncStreams([ValueSource(nameof(roslyn5OrNewerOptions))] CompilerOptions cscOptions)
|
||||
{
|
||||
await RunForLibrary("AsyncStreams", cscOptions: cscOptions | CompilerOptions.EnableRuntimeAsync | CompilerOptions.Preview);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RuntimeAsyncUsing([ValueSource(nameof(roslyn5OrNewerOptions))] CompilerOptions cscOptions)
|
||||
{
|
||||
await RunForLibrary(
|
||||
"AsyncUsing",
|
||||
cscOptions: cscOptions | CompilerOptions.EnableRuntimeAsync | CompilerOptions.Preview,
|
||||
configureDecompiler: settings => { settings.UseEnhancedUsing = false; }
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RuntimeAsyncCustomTaskType([ValueSource(nameof(roslyn5OrNewerOptions))] CompilerOptions cscOptions)
|
||||
{
|
||||
await RunForLibrary("CustomTaskType", cscOptions: cscOptions | CompilerOptions.EnableRuntimeAsync | CompilerOptions.Preview);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task NullableRefTypes([ValueSource(nameof(roslyn3OrNewerOptions))] CompilerOptions cscOptions)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user