Skip to content

Commit

Permalink
Merge pull request #3832 from bjornhellander/feature/languageversion
Browse files Browse the repository at this point in the history
Update some tests to not use a fixed language version
  • Loading branch information
sharwell authored Apr 29, 2024
2 parents 045aba1 + 3e259de commit 4d099a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#nullable disable

namespace StyleCop.Analyzers.Test.CSharp7.OrderingRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Testing;
using StyleCop.Analyzers.Test.Helpers;
using StyleCop.Analyzers.Test.OrderingRules;
using Xunit;
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
Expand All @@ -34,7 +33,7 @@ public async Task TestReadonlyRefKeywordInStructDeclarationAsync(string keywords
}}
}}
";
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2, testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2.OrLaterDefault(), testCode, DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}

[Fact]
Expand All @@ -53,7 +52,7 @@ readonly private struct BitHelper
{
Diagnostic().WithLocation(3, 14).WithArguments("private", "readonly"),
};
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2, testCode, expected, CancellationToken.None).ConfigureAwait(false);
await VerifyCSharpDiagnosticAsync(LanguageVersion.CSharp7_2.OrLaterDefault(), testCode, expected, CancellationToken.None).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#nullable disable

namespace StyleCop.Analyzers.Test.CSharp7.OrderingRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using StyleCop.Analyzers.Test.Helpers;
using StyleCop.Analyzers.Test.OrderingRules;
using Xunit;
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
Expand Down Expand Up @@ -38,7 +37,7 @@ public class TestClass
";

var expectedDiagnostic = Diagnostic().WithArguments("private", "protected").WithLocation(5, 19);
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_2, testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_2.OrLaterDefault(), testCode, expectedDiagnostic, fixedTestCode, CancellationToken.None).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#nullable disable

namespace StyleCop.Analyzers.Test.CSharp7.ReadabilityRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Testing;
using StyleCop.Analyzers.Test.Helpers;
using StyleCop.Analyzers.Test.ReadabilityRules;
using Xunit;
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
Expand Down Expand Up @@ -58,7 +57,7 @@ struct TestStruct
}}
";
DiagnosticResult expected = Diagnostic().WithLocation(8, 18);
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_1, testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
await VerifyCSharpFixAsync(LanguageVersion.CSharp7_1.OrLaterDefault(), testCode, expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
}
}
}

0 comments on commit 4d099a2

Please sign in to comment.