Skip to content

Commit

Permalink
Unify CSharpSourceGeneratorTest according to dotnet/roslyn-sdk#941
Browse files Browse the repository at this point in the history
  • Loading branch information
g7ed6e committed Nov 2, 2023
1 parent fd8ec88 commit d7aa905
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
Expand All @@ -15,11 +16,7 @@ public static class CSharpGeneratorVerifier<TSourceGenerator>
where TSourceGenerator : ISourceGenerator, new()
#endif
{
#if ROSLYN4_0_OR_GREATER
public class Test : CSharpIncrementalGeneratorTest<TSourceGenerator, DefaultVerifier>
#else
public class Test : CSharpSourceGeneratorTest<TSourceGenerator, DefaultVerifier>
#endif
public class Test : CSharpSourceGeneratorTest<EmptySourceGeneratorProvider, DefaultVerifier>
{
public Test()
{
Expand Down Expand Up @@ -48,6 +45,18 @@ private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarnings
protected override ParseOptions CreateParseOptions()
=> ((CSharpParseOptions)base.CreateParseOptions()).WithLanguageVersion(LanguageVersion);

#if ROSLYN4_0_OR_GREATER
protected override IEnumerable<ISourceGenerator> GetSourceGenerators()
{
yield return new TSourceGenerator().AsSourceGenerator();
}
#else
protected override IEnumerable<ISourceGenerator> GetSourceGenerators()
{
yield return new TSourceGenerator();
}
#endif

protected override bool IsCompilerDiagnosticIncluded(Diagnostic diagnostic, CompilerDiagnostics compilerDiagnostics) => false;
}
}
Expand Down

This file was deleted.

151 changes: 0 additions & 151 deletions src/System.ServiceModel.BuildTools/tests/IncrementalGeneratorTest`1.cs

This file was deleted.

0 comments on commit d7aa905

Please sign in to comment.