Skip to content

Commit 37b5291

Browse files
committed
Add test verifying fix.
1 parent 1a7266a commit 37b5291

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/PublicApiAnalyzers/UnitTests/DeclarePublicAPIAnalyzerTestsBase.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,25 @@ private C() { }
310310
await VerifyCSharpAsync(source, shippedText, unshippedText, $"[*]\r\n{editorconfigText}", expectedDiagnostics);
311311
}
312312

313+
[Fact]
314+
public async Task AnalyzerFilePresent_MissingNonEnabledText()
315+
{
316+
var source = $$"""
317+
318+
{{EnabledModifierCSharp}} class C
319+
{
320+
private C() { }
321+
}
322+
""";
323+
324+
string? shippedText = "";
325+
string? unshippedText = "";
326+
327+
var expectedDiagnostics = new[] { GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C") };
328+
329+
await VerifyCSharpAsync(source, shippedText, unshippedText, $"[*]\r\ndotnet_public_api_analyzer.require_api_files = true", expectedDiagnostics);
330+
}
331+
313332
[Fact]
314333
public async Task EmptyPublicAPIFilesAsync()
315334
{

0 commit comments

Comments
 (0)