Skip to content

Commit 4d099a2

Browse files
authored
Merge pull request #3832 from bjornhellander/feature/languageversion
Update some tests to not use a fixed language version
2 parents 045aba1 + 3e259de commit 4d099a2

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/OrderingRules/SA1206CSharp7UnitTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4-
#nullable disable
5-
64
namespace StyleCop.Analyzers.Test.CSharp7.OrderingRules
75
{
86
using System.Threading;
97
using System.Threading.Tasks;
108
using Microsoft.CodeAnalysis.CSharp;
119
using Microsoft.CodeAnalysis.Testing;
10+
using StyleCop.Analyzers.Test.Helpers;
1211
using StyleCop.Analyzers.Test.OrderingRules;
1312
using Xunit;
1413
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
@@ -34,7 +33,7 @@ public async Task TestReadonlyRefKeywordInStructDeclarationAsync(string keywords
3433
}}
3534
}}
3635
";
37-
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2, testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
36+
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2.OrLaterDefault(), testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
3837
}
3938

4039
[Fact]
@@ -53,7 +52,7 @@ readonly private struct BitHelper
5352
{
5453
Diagnostic().WithLocation(3, 14).WithArguments("private", "readonly"),
5554
};
56-
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2, testCode, expected, CancellationToken.None).ConfigureAwait(false);
55+
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2.OrLaterDefault(), testCode, expected, CancellationToken.None).ConfigureAwait(false);
5756
}
5857
}
5958
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/OrderingRules/SA1207CSharp7UnitTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4-
#nullable disable
5-
64
namespace StyleCop.Analyzers.Test.CSharp7.OrderingRules
75
{
86
using System.Threading;
97
using System.Threading.Tasks;
108
using Microsoft.CodeAnalysis.CSharp;
9+
using StyleCop.Analyzers.Test.Helpers;
1110
using StyleCop.Analyzers.Test.OrderingRules;
1211
using Xunit;
1312
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
@@ -38,7 +37,7 @@ public class TestClass
3837
";
3938

4039
var expectedDiagnostic = Diagnostic().WithArguments("private", "protected").WithLocation(5, 19);
41-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_2, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
40+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_2.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
4241
}
4342
}
4443
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4-
#nullable disable
5-
64
namespace StyleCop.Analyzers.Test.CSharp7.ReadabilityRules
75
{
86
using System.Threading;
97
using System.Threading.Tasks;
108
using Microsoft.CodeAnalysis.CSharp;
119
using Microsoft.CodeAnalysis.Testing;
10+
using StyleCop.Analyzers.Test.Helpers;
1211
using StyleCop.Analyzers.Test.ReadabilityRules;
1312
using Xunit;
1413
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
@@ -58,7 +57,7 @@ struct TestStruct
5857
}}
5958
";
6059
DiagnosticResult expected = Diagnostic().WithLocation(8, 18);
61-
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_1, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
60+
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_1.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
6261
}
6362
}
6463
}

0 commit comments

Comments
 (0)