powershell: add ability to ignore specific warnings in C# Add-Type (#47643)

This commit is contained in:
Jordan Borean
2018-11-06 10:48:31 +10:00
committed by GitHub
parent 150cdd7931
commit 8787c65b65
2 changed files with 52 additions and 2 deletions

View File

@@ -183,5 +183,26 @@ Add-CSharpType -References $reference_1, $reference_2
$actual = [Namespace6.Class6]::GetString()
Assert-Equals -actual $actual -expected "Hello World"
$ignored_warning = @'
using System;
//NoWarn -Name CS0219
namespace Namespace7
{
public class Class7
{
public static string GetString()
{
string a = "";
return "abc";
}
}
}
'@
Add-CSharpType -References $ignored_warning
$actual = [Namespace7.Class7]::GetString()
Assert-Equals -actual $actual -expected "abc"
$result.res = "success"
Exit-Json -obj $result