Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxNodeExtensions: increase GetBody coverage #8639

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

antonioaversa
Copy link
Contributor

Cover SyntaxNodeExtensions.GetBody, introduced in #8584 but not covered.

@github-actions github-actions bot added this to In progress in Best Kanban Jan 30, 2024
@antonioaversa antonioaversa marked this pull request as ready for review January 30, 2024 12:14
@antonioaversa antonioaversa added the Sprint: Hardening Fix FPs/FNs/improvements label Jan 30, 2024
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Jan 30, 2024
@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban Jan 30, 2024
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Jan 30, 2024
public void GetBody_PropertyDeclaration_SingleAccessor()
{
var code = "class AClass { int AProperty { get => 42; } }";
ExtensionsCS.GetBody(CSharpSyntaxTree.ParseText(code).Single<PropertyDeclarationSyntax>()).Should().BeNull();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ExtensionsCS.GetBody(CSharpSyntaxTree.ParseText(code).Single<T> is repeated very often. Extract a helper

BlockSyntax ParseForBlockSyntax<T>(string code) where T: CSharpSyntaxNode
    => ExtensionsCS.GetBody(CSharpSyntaxTree.ParseText(code).Single<T>());

@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban Jan 30, 2024
Copy link

sonarcloud bot commented Jan 30, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Jan 30, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@pavel-mikula-sonarsource pavel-mikula-sonarsource added Type: Tooling Tools make us productive. and removed Sprint: Hardening Fix FPs/FNs/improvements labels Feb 20, 2024
@@ -230,7 +281,7 @@ public void CreateCfg_FieldInitializerWithoutOperation_ReturnsCfg_CS()
const string code = """
public class Sample
{
private string field = null!; // null! itself doens't have operation, and we can still generate CFG for it from the equals clause
private string field = null!; // null! itself doesn't have operation, and we can still generate CFG for it from the equals clause
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have an operation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Tooling Tools make us productive.
Projects
Best Kanban
  
In progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants