mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
PS AddType - Add the ability to supply custom compile symbols for C# code (#54582)
This commit is contained in:
@@ -204,5 +204,28 @@ Add-CSharpType -References $ignored_warning
|
||||
$actual = [Namespace7.Class7]::GetString()
|
||||
Assert-Equals -actual $actual -expected "abc"
|
||||
|
||||
$defined_symbol = @'
|
||||
using System;
|
||||
|
||||
namespace Namespace8
|
||||
{
|
||||
public class Class8
|
||||
{
|
||||
public static string GetString()
|
||||
{
|
||||
#if SYMBOL1
|
||||
string a = "symbol";
|
||||
#else
|
||||
string a = "no symbol";
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
'@
|
||||
Add-CSharpType -References $defined_symbol -CompileSymbols "SYMBOL1"
|
||||
$actual = [Namespace8.Class8]::GetString()
|
||||
Assert-Equals -actual $actual -expected "symbol"
|
||||
|
||||
$result.res = "success"
|
||||
Exit-Json -obj $result
|
||||
|
||||
Reference in New Issue
Block a user