Skip to content

Commit f8a89a2

Browse files
committed
Updated tests
1 parent 1c48cde commit f8a89a2

File tree

1 file changed

+4
-94
lines changed

1 file changed

+4
-94
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/SA1001UnitTests.cs

Lines changed: 4 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace StyleCop.Analyzers.Test.SpacingRules
88
using System;
99
using System.Threading;
1010
using System.Threading.Tasks;
11-
using Microsoft;
1211
using Microsoft.CodeAnalysis.Testing;
1312
using StyleCop.Analyzers.SpacingRules;
1413
using Xunit;
@@ -446,26 +445,12 @@ partial struct Money : IFormattable
446445
}
447446
";
448447

449-
var expected = new[]
450-
{
451-
Diagnostic().WithLocation(0).WithArguments(" not", "preceded"),
452-
};
453-
454-
await VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
455-
}
456-
457-
[Fact]
458-
public async Task TestSpaceBeforeCommaFollowingIfDirectiveAsync()
459-
{
460-
var testCode = @"
448+
var fixedCode = @"
461449
interface IFormattable {}
462450
interface ISpanFormattable {}
463451
464-
partial struct Money : IFormattable
465-
#if true
466-
467-
{|#0:,|} ISpanFormattable
468-
#endif
452+
partial struct Money : IFormattable,
453+
ISpanFormattable
469454
{
470455
}
471456
";
@@ -475,82 +460,7 @@ partial struct Money : IFormattable
475460
Diagnostic().WithLocation(0).WithArguments(" not", "preceded"),
476461
};
477462

478-
await VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
479-
}
480-
481-
[Fact]
482-
public async Task TestSpaceBeforeCommaFollowingElifDirectiveAsync()
483-
{
484-
var testCode = @"
485-
interface IFormattable {}
486-
interface ISpanFormattable {}
487-
488-
partial struct Money : IFormattable
489-
#if false
490-
#elif true
491-
492-
{|#0:,|} ISpanFormattable
493-
#endif
494-
{
495-
}
496-
";
497-
498-
var expected = new[]
499-
{
500-
Diagnostic().WithLocation(0).WithArguments(" not", "preceded"),
501-
};
502-
503-
await VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
504-
}
505-
506-
[Fact]
507-
public async Task TestSpaceBeforeCommaFollowingElseDirectiveAsync()
508-
{
509-
var testCode = @"
510-
interface IFormattable {}
511-
interface ISpanFormattable {}
512-
513-
partial struct Money : IFormattable
514-
#if false
515-
#else
516-
517-
{|#0:,|} ISpanFormattable
518-
#endif
519-
{
520-
}
521-
";
522-
523-
var expected = new[]
524-
{
525-
Diagnostic().WithLocation(0).WithArguments(" not", "preceded"),
526-
};
527-
528-
await VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
529-
}
530-
531-
[Fact]
532-
public async Task TestSpaceBeforeCommaFollowingEndIfDirectiveAsync()
533-
{
534-
var testCode = @"
535-
interface IFormattable {}
536-
interface ISpanFormattable {}
537-
538-
partial struct Money : IFormattable
539-
#if false
540-
#elif true
541-
#endif
542-
543-
{|#0:,|} ISpanFormattable
544-
{
545-
}
546-
";
547-
548-
var expected = new[]
549-
{
550-
Diagnostic().WithLocation(0).WithArguments(" not", "preceded"),
551-
};
552-
553-
await VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
463+
await VerifyCSharpFixAsync(testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
554464
}
555465

556466
private Task TestCommaInStatementOrDeclAsync(string originalStatement, DiagnosticResult expected, string fixedStatement)

0 commit comments

Comments
 (0)