File tree 1 file changed +8
-5
lines changed
src/Framework/AspNetCoreAnalyzers/test/Http 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -147,22 +147,25 @@ public static IEnumerable<object[]> FixedWithAppendAddsUsingDirectiveTestData()
147
147
} ;
148
148
}
149
149
150
- [ ConditionalTheory ]
151
- [ OSSkipCondition ( OperatingSystems . Linux ) ]
152
- [ OSSkipCondition ( OperatingSystems . MacOSX ) ]
150
+ [ Theory ]
153
151
[ MemberData ( nameof ( FixedWithAppendAddsUsingDirectiveTestData ) ) ]
154
152
public async Task IHeaderDictionary_WithAdd_FixedWithAppend_AddsUsingDirective ( string source , string fixedSource )
155
153
{
154
+ // Source is cloned on Windows with CRLF line endings, then the test is run by Helix in Windows/Linux/macOS.
155
+ // When Roslyn adds a new `using`, it gets added followed by Environment.NewLine.
156
+ // For Linux/macOS, the actual result is `\n`, however, the source is cloned on Windows with CRLF expectation.
157
+ // We replace all line endings with Environment.NewLine to avoid this.
158
+
156
159
// Arrange & Act & Assert
157
160
await VerifyCS . VerifyCodeFixAsync (
158
- source . TrimStart ( ) ,
161
+ source . TrimStart ( ) . ReplaceLineEndings ( ) ,
159
162
new [ ]
160
163
{
161
164
new DiagnosticResult ( DiagnosticDescriptors . DoNotUseIHeaderDictionaryAdd )
162
165
. WithLocation ( 0 )
163
166
. WithMessage ( Resources . Analyzer_HeaderDictionaryAdd_Message )
164
167
} ,
165
- fixedSource . TrimStart ( ) ,
168
+ fixedSource . TrimStart ( ) . ReplaceLineEndings ( ) ,
166
169
codeActionEquivalenceKey : AppendCodeActionEquivalenceKey ) ;
167
170
}
168
171
You can’t perform that action at this time.
0 commit comments