diff options
Diffstat (limited to 'src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs')
-rw-r--r-- | src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs deleted file mode 100644 index 27729ac8..00000000 --- a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.Dnc.HostGenerator | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Immutable; | ||
7 | using Microsoft.CodeAnalysis; | ||
8 | using Microsoft.CodeAnalysis.CSharp; | ||
9 | using Microsoft.CodeAnalysis.CSharp.Testing; | ||
10 | using Microsoft.CodeAnalysis.Testing.Verifiers; | ||
11 | |||
12 | public static class CSharpSourceGeneratorVerifier<TSourceGenerator> | ||
13 | where TSourceGenerator : ISourceGenerator, new() | ||
14 | { | ||
15 | public class Test : CSharpSourceGeneratorTest<TSourceGenerator, XUnitVerifier> | ||
16 | { | ||
17 | public Test() | ||
18 | { | ||
19 | } | ||
20 | |||
21 | protected override CompilationOptions CreateCompilationOptions() | ||
22 | { | ||
23 | var compilationOptions = base.CreateCompilationOptions(); | ||
24 | return compilationOptions.WithSpecificDiagnosticOptions( | ||
25 | compilationOptions.SpecificDiagnosticOptions.SetItems(GetNullableWarningsFromCompiler())); | ||
26 | } | ||
27 | |||
28 | public LanguageVersion LanguageVersion { get; set; } = LanguageVersion.Default; | ||
29 | |||
30 | private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler() | ||
31 | { | ||
32 | string[] args = { "/warnaserror:nullable" }; | ||
33 | var commandLineArguments = CSharpCommandLineParser.Default.Parse(args, baseDirectory: Environment.CurrentDirectory, sdkDirectory: Environment.CurrentDirectory); | ||
34 | var nullableWarnings = commandLineArguments.CompilationOptions.SpecificDiagnosticOptions; | ||
35 | |||
36 | return nullableWarnings; | ||
37 | } | ||
38 | |||
39 | protected override ParseOptions CreateParseOptions() | ||
40 | { | ||
41 | return ((CSharpParseOptions)base.CreateParseOptions()).WithLanguageVersion(this.LanguageVersion); | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | } | ||