Skip to content

Commit 26fe7ca

Browse files
committed
Added tests to improve coverage in SA1013 (ClosingCurlyBracketsMustBeSpacedCorrectly)
1 parent fcb0b15 commit 26fe7ca

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/SA1013UnitTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace StyleCop.Analyzers.Test.SpacingRules
66
using System.Collections.Generic;
77
using System.Threading;
88
using System.Threading.Tasks;
9+
using Microsoft.CodeAnalysis;
910
using Microsoft.CodeAnalysis.CodeFixes;
1011
using Microsoft.CodeAnalysis.Diagnostics;
1112
using StyleCop.Analyzers.SpacingRules;
@@ -384,6 +385,28 @@ public async Task TestEndOfFileWithoutNewLineAsync(string declarationType)
384385
await this.VerifyCSharpDiagnosticAsync(testCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
385386
}
386387

388+
[Fact]
389+
public async Task TestMissingTokenAsync()
390+
{
391+
string testCode = @"
392+
class ClassName
393+
{
394+
";
395+
396+
DiagnosticResult[] expected =
397+
{
398+
new DiagnosticResult
399+
{
400+
Id = "CS1513",
401+
Severity = DiagnosticSeverity.Error,
402+
Message = "} expected",
403+
Locations = new[] { new DiagnosticResultLocation("Test0.cs", 3, 2) }
404+
}
405+
};
406+
407+
await this.VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
408+
}
409+
387410
/// <inheritdoc/>
388411
protected override IEnumerable<DiagnosticAnalyzer> GetCSharpDiagnosticAnalyzers()
389412
{

0 commit comments

Comments
 (0)