Skip to content

Commit

Permalink
Remove non-empty input requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Mar 9, 2021
1 parent 2e00b07 commit 78d4055
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ protected override IEnumerable<DiagnosticAnalyzer> GetDiagnosticAnalyzers()

public override async Task RunAsync(CancellationToken cancellationToken = default)
{
Verify.NotEmpty($"{nameof(TestState)}.{nameof(SolutionState.Sources)}", TestState.Sources);

var analyzers = GetDiagnosticAnalyzers().ToArray();
var defaultDiagnostic = GetDefaultDiagnostic(analyzers);
var supportedDiagnostics = analyzers.SelectMany(analyzer => analyzer.SupportedDiagnostics).ToImmutableArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,27 @@ public async Task AddSimpleFileByGeneratorTypeWithEncoding()
}.RunAsync();
}

[Fact]
public async Task AddSimpleFileToEmptyProject()
{
await new CSharpSourceGeneratorTest<AddEmptyFile>
{
TestState =
{
Sources =
{
},
},
FixedState =
{
Sources =
{
(typeof(AddEmptyFile), "EmptyGeneratedFile.cs", string.Empty),
},
},
}.RunAsync();
}

[Fact]
public async Task AddSimpleFileWithDiagnostic()
{
Expand Down

0 comments on commit 78d4055

Please sign in to comment.