Skip to content

Commit cd6db3b

Browse files
committed
Add regression tests for tabs inside comments
1 parent 573b29f commit cd6db3b

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers.Test/SpacingRules/SA1027UnitTests.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ public void Bar()
101101
public async Task TestInvalidTabsInDocumentationCommentsAsync()
102102
{
103103
var testCode =
104-
"\t/// <summary>\r\n" +
105-
"\t/// foo bar\r\n" +
106-
"\t/// </summary>\r\n" +
104+
"\t///\t<summary>\r\n" +
105+
"\t/// foo\tbar\r\n" +
106+
"\t///\t</summary>\r\n" +
107107
"\tpublic class Foo\r\n" +
108108
"\t{\r\n" +
109-
"\t \t/// <MyElement> Value </MyElement>\r\n" +
110-
"\t\t/// <MyElement> Value </MyElement>\r\n" +
109+
"\t \t/// <MyElement>\tValue </MyElement>\r\n" +
110+
"\t\t/** <MyElement> Value </MyElement>\t*/\r\n" +
111111
"\t}\r\n";
112112

113113
var fixedTestCode = @" /// <summary>
@@ -116,19 +116,24 @@ public async Task TestInvalidTabsInDocumentationCommentsAsync()
116116
public class Foo
117117
{
118118
/// <MyElement> Value </MyElement>
119-
/// <MyElement> Value </MyElement>
119+
/** <MyElement> Value </MyElement> */
120120
}
121121
";
122122

123123
DiagnosticResult[] expected =
124124
{
125125
this.CSharpDiagnostic().WithLocation(1, 1),
126+
this.CSharpDiagnostic().WithLocation(1, 5),
126127
this.CSharpDiagnostic().WithLocation(2, 1),
128+
this.CSharpDiagnostic().WithLocation(2, 5),
127129
this.CSharpDiagnostic().WithLocation(3, 1),
130+
this.CSharpDiagnostic().WithLocation(3, 5),
128131
this.CSharpDiagnostic().WithLocation(4, 1),
129132
this.CSharpDiagnostic().WithLocation(5, 1),
130133
this.CSharpDiagnostic().WithLocation(6, 1),
134+
this.CSharpDiagnostic().WithLocation(6, 19),
131135
this.CSharpDiagnostic().WithLocation(7, 1),
136+
this.CSharpDiagnostic().WithLocation(7, 37),
132137
this.CSharpDiagnostic().WithLocation(8, 1),
133138
};
134139

0 commit comments

Comments
 (0)