|
1 | 1 | using Microsoft.CodeAnalysis;
|
2 | 2 | using Microsoft.CodeAnalysis.CSharp;
|
3 | 3 | using Microsoft.CodeAnalysis.CSharp.Testing;
|
4 |
| -using Microsoft.CodeAnalysis.Testing.Verifiers; |
| 4 | +using Microsoft.CodeAnalysis.Testing; |
5 | 5 | using System.Collections.Immutable;
|
6 | 6 |
|
7 | 7 | namespace DecoratorGenerator.UnitTests;
|
8 | 8 |
|
9 | 9 | public static class CSharpSourceGeneratorVerifier<TSourceGenerator> where TSourceGenerator : ISourceGenerator, new()
|
10 | 10 | {
|
11 |
| - public class Test : CSharpSourceGeneratorTest<TSourceGenerator, NUnitVerifier> |
| 11 | + public class Test : CSharpSourceGeneratorTest<TSourceGenerator, DefaultVerifier> |
12 | 12 | {
|
13 |
| - public Test() |
14 |
| - { |
| 13 | + public Test() { |
15 | 14 | }
|
16 | 15 |
|
17 |
| - protected override CompilationOptions CreateCompilationOptions() |
18 |
| - { |
| 16 | + protected override CompilationOptions CreateCompilationOptions() { |
19 | 17 | var compilationOptions = base.CreateCompilationOptions();
|
20 | 18 | return compilationOptions.WithSpecificDiagnosticOptions(
|
21 | 19 | compilationOptions.SpecificDiagnosticOptions.SetItems(GetNullableWarningsFromCompiler()));
|
22 | 20 | }
|
23 | 21 |
|
24 | 22 | public LanguageVersion LanguageVersion { get; set; } = LanguageVersion.Default;
|
25 | 23 |
|
26 |
| - private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler() |
27 |
| - { |
| 24 | + private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler() { |
28 | 25 | string[] args = { "/warnaserror:nullable" };
|
29 | 26 | var commandLineArguments = CSharpCommandLineParser.Default.Parse(args, baseDirectory: Environment.CurrentDirectory, sdkDirectory: Environment.CurrentDirectory);
|
30 | 27 | var nullableWarnings = commandLineArguments.CompilationOptions.SpecificDiagnosticOptions;
|
31 | 28 |
|
32 | 29 | return nullableWarnings;
|
33 | 30 | }
|
34 | 31 |
|
35 |
| - protected override ParseOptions CreateParseOptions() |
36 |
| - { |
| 32 | + protected override ParseOptions CreateParseOptions() { |
37 | 33 | return ((CSharpParseOptions)base.CreateParseOptions()).WithLanguageVersion(LanguageVersion);
|
38 | 34 | }
|
39 | 35 | }
|
|
0 commit comments