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

Improve test coverage for IsMemberDeclaration method #48163

Open
Youssef1313 opened this issue Sep 29, 2020 · 3 comments
Open

Improve test coverage for IsMemberDeclaration method #48163

Youssef1313 opened this issue Sep 29, 2020 · 3 comments
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it Test-Gap Describes a specific feature or scenario that does not have test coverage
Milestone

Comments

@Youssef1313
Copy link
Member

I don't think it's a good idea to update this one without knowing the change it introduce.

This whole method isn't covered in the tests. See how #48158 is green.

Originally posted by @Youssef1313 in #48137 (comment)

@Youssef1313
Copy link
Member Author

After figuring out what this method affects, we need to decide whether to update it with init accessor or not.

@Youssef1313
Copy link
Member Author

I could get test failures in #48158 by the last commit in it. But still, doesn't cover everything in the method.

@sharwell
Copy link
Member

sharwell commented Sep 30, 2020

This is in reference to the following method:

private static bool IsMemberDeclaration(SyntaxNode node)
{
// From the C# language spec:
// class-member-declaration:
// constant-declaration
// field-declaration
// method-declaration
// property-declaration
// event-declaration
// indexer-declaration
// operator-declaration
// constructor-declaration
// destructor-declaration
// static-constructor-declaration
// type-declaration
switch (node.Kind())
{
// Because fields declarations can define multiple symbols "public int a, b;"
// We want to get the VariableDeclarator node inside the field declaration to print out the symbol for the name.
case SyntaxKind.VariableDeclarator:
return node.Parent.Parent.IsKind(SyntaxKind.FieldDeclaration) ||
node.Parent.Parent.IsKind(SyntaxKind.EventFieldDeclaration);
case SyntaxKind.FieldDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.GetAccessorDeclaration:
case SyntaxKind.SetAccessorDeclaration:
case SyntaxKind.EventDeclaration:
case SyntaxKind.EventFieldDeclaration:
case SyntaxKind.AddAccessorDeclaration:
case SyntaxKind.RemoveAccessorDeclaration:
case SyntaxKind.IndexerDeclaration:
case SyntaxKind.OperatorDeclaration:
case SyntaxKind.ConversionOperatorDeclaration:
case SyntaxKind.ConstructorDeclaration:
case SyntaxKind.DestructorDeclaration:
return true;
default:
return false;
}
}

@sharwell sharwell added Area-IDE Test-Gap Describes a specific feature or scenario that does not have test coverage labels Sep 30, 2020
@jinujoseph jinujoseph added the help wanted The issue is "up for grabs" - add a comment if you are interested in working on it label Oct 15, 2020
@jinujoseph jinujoseph added this to the Backlog milestone Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it Test-Gap Describes a specific feature or scenario that does not have test coverage
Projects
None yet
Development

No branches or pull requests

3 participants