Skip to content

Commit a69732f

Browse files
authored
Merge pull request #3616 from bjornhellander/feature/languageversion
Update so that c# 7 tests will be run with the expected language version in test projects for c# 8 and above
2 parents 26e3c69 + b7d86f1 commit a69732f

18 files changed

+88
-39
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/LayoutRules/SA1500CSharp7UnitTests.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.LayoutRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.LayoutRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.LayoutRules.SA1500BracesForMultiLineStatementsMustNotShareLine,
1617
StyleCop.Analyzers.LayoutRules.SA1500CodeFixProvider>;
@@ -199,7 +200,7 @@ public unsafe void TestMethod()
199200
};
200201
}
201202
}";
202-
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_3, testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
203+
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
203204
}
204205

205206
/// <summary>
@@ -277,7 +278,7 @@ public unsafe void TestMethod()
277278
Diagnostic().WithLocation(23, 22),
278279
};
279280

280-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostics, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
281+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostics, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
281282
}
282283

283284
/// <summary>
@@ -335,7 +336,7 @@ public unsafe void TestMethod()
335336
Diagnostic().WithLocation(15, 22),
336337
};
337338

338-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostics, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
339+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostics, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
339340
}
340341
}
341342
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/LayoutRules/SA1505CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.LayoutRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.LayoutRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.LayoutRules.SA1505OpeningBracesMustNotBeFollowedByBlankLine,
1617
StyleCop.Analyzers.LayoutRules.SA1505CodeFixProvider>;
@@ -129,7 +130,7 @@ public unsafe void TestMethod()
129130
";
130131

131132
var expectedDiagnostic = Diagnostic().WithLocation(8, 13);
132-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
133+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
133134
}
134135

135136
[Fact]
@@ -171,7 +172,7 @@ public unsafe void TestMethod()
171172
";
172173

173174
var expectedDiagnostic = Diagnostic().WithLocation(8, 13);
174-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
175+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
175176
}
176177
}
177178
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/LayoutRules/SA1508CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.LayoutRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.LayoutRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.LayoutRules.SA1508ClosingBracesMustNotBePrecededByBlankLine,
1617
StyleCop.Analyzers.LayoutRules.SA1508CodeFixProvider>;
@@ -129,7 +130,7 @@ public unsafe void TestMethod()
129130
";
130131

131132
var expectedDiagnostic = Diagnostic().WithLocation(13, 13);
132-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
133+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
133134
}
134135

135136
[Fact]
@@ -171,7 +172,7 @@ public unsafe void TestMethod()
171172
";
172173

173174
var expectedDiagnostic = Diagnostic().WithLocation(13, 13);
174-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
175+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
175176
}
176177
}
177178
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/LayoutRules/SA1509CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.LayoutRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.LayoutRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.LayoutRules.SA1509OpeningBracesMustNotBePrecededByBlankLine,
1617
StyleCop.Analyzers.LayoutRules.SA1509CodeFixProvider>;
@@ -116,7 +117,7 @@ public unsafe void TestMethod()
116117
";
117118

118119
var expectedDiagnostic = Diagnostic().WithLocation(9, 13);
119-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
120+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
120121
}
121122

122123
[Fact]
@@ -158,7 +159,7 @@ public unsafe void TestMethod()
158159
";
159160

160161
var expectedDiagnostic = Diagnostic().WithLocation(9, 13);
161-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
162+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
162163
}
163164
}
164165
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/LayoutRules/SA1513CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.LayoutRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.LayoutRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.LayoutRules.SA1513ClosingBraceMustBeFollowedByBlankLine,
1617
StyleCop.Analyzers.LayoutRules.SA1513CodeFixProvider>;
@@ -171,7 +172,7 @@ public unsafe void TestMethod()
171172
}
172173
";
173174

174-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, DiagnosticResult.EmptyDiagnosticResults, testCode, CancellationToken.None).ConfigureAwait(false);
175+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, DiagnosticResult.EmptyDiagnosticResults, testCode, CancellationToken.None).ConfigureAwait(false);
175176
}
176177

177178
[Fact]
@@ -200,7 +201,7 @@ public unsafe void TestMethod()
200201
}
201202
";
202203

203-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, DiagnosticResult.EmptyDiagnosticResults, testCode, CancellationToken.None).ConfigureAwait(false);
204+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, DiagnosticResult.EmptyDiagnosticResults, testCode, CancellationToken.None).ConfigureAwait(false);
204205
}
205206
}
206207
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/MaintainabilityRules/SA1413CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.MaintainabilityRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.MaintainabilityRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.MaintainabilityRules.SA1413UseTrailingCommasInMultiLineInitializers,
1617
StyleCop.Analyzers.MaintainabilityRules.SA1413CodeFixProvider>;
@@ -61,7 +62,7 @@ public unsafe void TestMethod()
6162
Diagnostic().WithLocation(12, 17),
6263
};
6364

64-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
65+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
6566
}
6667

6768
[Fact]
@@ -108,7 +109,7 @@ public unsafe void TestMethod()
108109
Diagnostic().WithLocation(12, 17),
109110
};
110111

111-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
112+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
112113
}
113114
}
114115
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/NamingRules/SA1316CSharp7UnitTests.cs

+10-9
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ namespace StyleCop.Analyzers.Test.CSharp7.NamingRules
77
{
88
using System.Threading;
99
using System.Threading.Tasks;
10+
using Microsoft.CodeAnalysis.CSharp;
1011
using Microsoft.CodeAnalysis.Testing;
11-
using StyleCop.Analyzers.Lightup;
1212
using StyleCop.Analyzers.NamingRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.NamingRules.SA1316TupleElementNamesShouldUseCorrectCasing,
1617
StyleCop.Analyzers.NamingRules.SA1316CodeFixProvider>;
@@ -116,7 +117,7 @@ public class TestClass
116117
}}
117118
";
118119

119-
await VerifyCSharpDiagnosticAsync(LanguageVersionEx.CSharp7, testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
120+
await VerifyCSharpDiagnosticAsync(testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
120121
}
121122

122123
/// <summary>
@@ -136,7 +137,7 @@ public class TestClass
136137
}
137138
";
138139

139-
await VerifyCSharpDiagnosticAsync(LanguageVersionEx.CSharp7, testCode, DefaultTestSettings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
140+
await VerifyCSharpDiagnosticAsync(testCode, DefaultTestSettings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
140141
}
141142

142143
/// <summary>
@@ -168,7 +169,7 @@ public void TestMethod()
168169
}}
169170
";
170171

171-
await VerifyCSharpDiagnosticAsync(LanguageVersionEx.CSharp7_1, testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
172+
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_1.OrLaterDefault(), testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
172173
}
173174

174175
/// <summary>
@@ -204,7 +205,7 @@ public void TestMethod2()
204205
}}
205206
";
206207

207-
await VerifyCSharpDiagnosticAsync(LanguageVersionEx.CSharp7_1, testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
208+
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_1.OrLaterDefault(), testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
208209
}
209210

210211
/// <summary>
@@ -257,7 +258,7 @@ public class TestClass
257258
// diagnostics are specified inline
258259
};
259260

260-
await VerifyCSharpFixAsync(LanguageVersionEx.CSharp7, testCode, settings, expectedDiagnostics, fixedCode, CancellationToken.None).ConfigureAwait(false);
261+
await VerifyCSharpFixAsync(testCode, settings, expectedDiagnostics, fixedCode, CancellationToken.None).ConfigureAwait(false);
261262
}
262263

263264
/// <summary>
@@ -287,7 +288,7 @@ public void TestMethod()
287288
}}
288289
";
289290

290-
await VerifyCSharpDiagnosticAsync(LanguageVersionEx.CSharp7_1, testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
291+
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_1.OrLaterDefault(), testCode, settings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
291292
}
292293

293294
/// <summary>
@@ -327,7 +328,7 @@ public void TestMethod2()
327328
// diagnostics are specified inline
328329
};
329330

330-
await VerifyCSharpDiagnosticAsync(LanguageVersionEx.CSharp7_1, testCode, settings, expectedDiagnostics, CancellationToken.None).ConfigureAwait(false);
331+
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_1.OrLaterDefault(), testCode, settings, expectedDiagnostics, CancellationToken.None).ConfigureAwait(false);
331332
}
332333

333334
[Fact]
@@ -398,7 +399,7 @@ public void MethodName((string Name, string Value) obj)
398399
}
399400
";
400401

401-
await VerifyCSharpDiagnosticAsync(LanguageVersionEx.CSharp7, testCode, DefaultTestSettings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
402+
await VerifyCSharpDiagnosticAsync(testCode, DefaultTestSettings, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
402403
}
403404
}
404405
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/ReadabilityRules/SA1137CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.ReadabilityRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.ReadabilityRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.ReadabilityRules.SA1137ElementsShouldHaveTheSameIndentation,
1617
StyleCop.Analyzers.ReadabilityRules.IndentationCodeFixProvider>;
@@ -160,7 +161,7 @@ public unsafe void TestMethod()
160161
Diagnostic().WithLocation(17, 1),
161162
};
162163

163-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
164+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
164165
}
165166

166167
[Fact]
@@ -220,7 +221,7 @@ public unsafe void TestMethod()
220221
Diagnostic().WithLocation(17, 1),
221222
};
222223

223-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
224+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
224225
}
225226
}
226227
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/SpacingRules/SA1000CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.SpacingRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.SpacingRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.SpacingRules.SA1000KeywordsMustBeSpacedCorrectly,
1617
StyleCop.Analyzers.SpacingRules.TokenSpacingCodeFixProvider>;
@@ -246,10 +247,10 @@ public async Task TestStackAllocImplicitArrayStatementAsync()
246247

247248
string statementWithSpace = @"int* x = stackalloc [] { 3 };";
248249

249-
await this.TestKeywordStatementAsync(statementWithoutSpace, DiagnosticResult.EmptyDiagnosticResults, statementWithoutSpace, languageVersion: LanguageVersion.CSharp7_3).ConfigureAwait(false);
250+
await this.TestKeywordStatementAsync(statementWithoutSpace, DiagnosticResult.EmptyDiagnosticResults, statementWithoutSpace, languageVersion: LanguageVersion.CSharp7_3.OrLaterDefault()).ConfigureAwait(false);
250251

251252
// this case is handled by SA1026, so it shouldn't be reported here
252-
await this.TestKeywordStatementAsync(statementWithSpace, DiagnosticResult.EmptyDiagnosticResults, statementWithSpace, languageVersion: LanguageVersion.CSharp7_3).ConfigureAwait(false);
253+
await this.TestKeywordStatementAsync(statementWithSpace, DiagnosticResult.EmptyDiagnosticResults, statementWithSpace, languageVersion: LanguageVersion.CSharp7_3.OrLaterDefault()).ConfigureAwait(false);
253254
}
254255
}
255256
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/SpacingRules/SA1001CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.SpacingRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.SpacingRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.SpacingRules.SA1001CommasMustBeSpacedCorrectly,
1617
StyleCop.Analyzers.SpacingRules.TokenSpacingCodeFixProvider>;
@@ -158,7 +159,7 @@ public unsafe void TestMethod()
158159
Diagnostic().WithLocation(8, 47).WithArguments(string.Empty, "followed"),
159160
};
160161

161-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
162+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
162163
}
163164

164165
[Fact]
@@ -197,7 +198,7 @@ public unsafe void TestMethod()
197198
Diagnostic().WithLocation(8, 43).WithArguments(string.Empty, "followed"),
198199
};
199200

200-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
201+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
201202
}
202203
}
203204
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/SpacingRules/SA1002CSharp7UnitTests.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace StyleCop.Analyzers.Test.CSharp7.SpacingRules
1111
using Microsoft.CodeAnalysis.Testing;
1212
using StyleCop.Analyzers.Test.SpacingRules;
1313
using Xunit;
14+
using static StyleCop.Analyzers.Test.Helpers.LanguageVersionTestExtensions;
1415
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
1516
StyleCop.Analyzers.SpacingRules.SA1002SemicolonsMustBeSpacedCorrectly,
1617
StyleCop.Analyzers.SpacingRules.TokenSpacingCodeFixProvider>;
@@ -49,7 +50,7 @@ public unsafe void TestMethod()
4950
Diagnostic().WithArguments(" not", "preceded").WithLocation(7, 51),
5051
};
5152

52-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
53+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
5354
}
5455

5556
[Fact]
@@ -84,7 +85,7 @@ public unsafe void TestMethod()
8485
Diagnostic().WithArguments(" not", "preceded").WithLocation(7, 47),
8586
};
8687

87-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
88+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_3.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
8889
}
8990
}
9091
}

0 commit comments

Comments
 (0)