Skip to content

Commit 4484f72

Browse files
authored
Merge pull request #3908 from bjornhellander/feature/csharp13-test-nuget-update
Update the code analysis nuget in the c# 13 test project to the official 4.12.0 version
2 parents c61c513 + 76cb4c6 commit 4484f72

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp13/LayoutRules/SA1504CSharp13UnitTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33

44
namespace StyleCop.Analyzers.Test.CSharp13.LayoutRules
55
{
6+
using Microsoft.CodeAnalysis.Testing;
67
using StyleCop.Analyzers.Test.CSharp12.LayoutRules;
78

89
public partial class SA1504CSharp13UnitTests : SA1504CSharp12UnitTests
910
{
11+
protected override DiagnosticResult[] GetExpectedResultAccessorWithoutBody()
12+
{
13+
return new DiagnosticResult[]
14+
{
15+
DiagnosticResult.CompilerError("CS8652").WithMessage("The feature 'field keyword' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version.").WithLocation(4, 16),
16+
};
17+
}
1018
}
1119
}

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp13/StyleCop.Analyzers.Test.CSharp13.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0-1.24376.3" />
21+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" />
2222
<PackageReference Include="xunit" Version="2.4.1" />
2323
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="all" />
2424
</ItemGroup>

StyleCop.Analyzers/StyleCop.Analyzers.Test/LayoutRules/SA1504UnitTests.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,8 @@ public int Prop
303303
}
304304
}
305305
}";
306-
DiagnosticResult[] expected =
307-
{
308-
DiagnosticResult.CompilerError("CS0501").WithMessage("'Foo.Prop.get' must declare a body because it is not marked abstract, extern, or partial").WithLocation(6, 9),
309-
};
310306

307+
var expected = this.GetExpectedResultAccessorWithoutBody();
311308
await VerifyCSharpDiagnosticAsync(testCode, expected, CancellationToken.None).ConfigureAwait(false);
312309
}
313310

@@ -387,5 +384,13 @@ public int Prop
387384
CodeActionIndex = 1,
388385
}.RunAsync(CancellationToken.None).ConfigureAwait(false);
389386
}
387+
388+
protected virtual DiagnosticResult[] GetExpectedResultAccessorWithoutBody()
389+
{
390+
return new DiagnosticResult[]
391+
{
392+
DiagnosticResult.CompilerError("CS0501").WithMessage("'Foo.Prop.get' must declare a body because it is not marked abstract, extern, or partial").WithLocation(6, 9),
393+
};
394+
}
390395
}
391396
}

0 commit comments

Comments
 (0)