22// The .NET Foundation licenses this file to you under the MIT license.
33
44using System ;
5+ using System . Collections . Generic ;
56using System . Collections . Immutable ;
67using Microsoft . CodeAnalysis ;
78using Microsoft . CodeAnalysis . CSharp ;
@@ -15,11 +16,7 @@ public static class CSharpGeneratorVerifier<TSourceGenerator>
1516 where TSourceGenerator : ISourceGenerator , new ( )
1617#endif
1718{
18- #if ROSLYN4_0_OR_GREATER
19- public class Test : CSharpIncrementalGeneratorTest < TSourceGenerator , DefaultVerifier >
20- #else
21- public class Test : CSharpSourceGeneratorTest < TSourceGenerator , DefaultVerifier >
22- #endif
19+ public class Test : CSharpSourceGeneratorTest < EmptySourceGeneratorProvider , DefaultVerifier >
2320 {
2421 public Test ( )
2522 {
@@ -48,6 +45,18 @@ private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarnings
4845 protected override ParseOptions CreateParseOptions ( )
4946 => ( ( CSharpParseOptions ) base . CreateParseOptions ( ) ) . WithLanguageVersion ( LanguageVersion ) ;
5047
48+ #if ROSLYN4_0_OR_GREATER
49+ protected override IEnumerable < ISourceGenerator > GetSourceGenerators ( )
50+ {
51+ yield return new TSourceGenerator ( ) . AsSourceGenerator ( ) ;
52+ }
53+ #else
54+ protected override IEnumerable < ISourceGenerator > GetSourceGenerators ( )
55+ {
56+ yield return new TSourceGenerator ( ) ;
57+ }
58+ #endif
59+
5160 protected override bool IsCompilerDiagnosticIncluded ( Diagnostic diagnostic , CompilerDiagnostics compilerDiagnostics ) => false ;
5261 }
5362}
0 commit comments