Skip to content

Commit

Permalink
Update so that SA1600 tests will be run with the expected language ve…
Browse files Browse the repository at this point in the history
…rsion in test projects for c# 8 and above

DotNetAnalyzers#3493
  • Loading branch information
bjornhellander committed Mar 12, 2023
1 parent 50610bc commit f402ba3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ protected override DiagnosticResult[] GetExpectedResultTestRegressionMethodGloba
// /0/Test0.cs(4,1): error CS0106: The modifier 'public' is not valid for this item
DiagnosticResult.CompilerError("CS0106").WithSpan(4, 1, 4, 7).WithArguments("public"),

// /0/Test0.cs(4,1): error CS8320: Feature 'top-level statements' is not available in C# 7.2. Please use language version 9.0 or greater.
DiagnosticResult.CompilerError("CS8320").WithSpan(4, 1, 4, 29).WithArguments("top-level statements", "9.0"),

// /0/Test0.cs(4,1): error CS8805: Program using top-level statements must be an executable.
DiagnosticResult.CompilerError("CS8805").WithSpan(4, 1, 4, 29),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

namespace StyleCop.Analyzers.Test.CSharp8.DocumentationRules
{
using Microsoft.CodeAnalysis.CSharp;
using StyleCop.Analyzers.Test.CSharp7.DocumentationRules;

public class SA1600CSharp8UnitTests : SA1600CSharp7UnitTests
{
// Using 'Default' here makes sure that later test projects also run these test with their own language version, without having to override this property
protected override LanguageVersion LanguageVersion => LanguageVersion.Default;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ protected override DiagnosticResult[] GetExpectedResultTestRegressionMethodGloba

// /0/Test0.cs(4,1): error CS0106: The modifier 'public' is not valid for this item
DiagnosticResult.CompilerError("CS0106").WithSpan(4, 1, 4, 7).WithArguments("public"),

// /0/Test0.cs(4,1): error CS8320: Feature 'top-level statements' is not available in C# 7.2. Please use language version 9.0 or greater.
DiagnosticResult.CompilerError("CS8320").WithSpan(4, 1, 4, 29).WithArguments("top-level statements", "9.0"),
};
}

Expand Down

0 comments on commit f402ba3

Please sign in to comment.