-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add unit tests for C# diagnostic analyzers #86434
Conversation
…l-with-generic-typed-attributes' into fix-must-be-variant-analyzer-fail-with-generic-typed-attributes
…eric-typed-attributes
…eVariantAnalyzer.cs Co-authored-by: Raul Santos <raulsntos@gmail.com>
…eVariantAnalyzer.cs Co-authored-by: Raul Santos <raulsntos@gmail.com>
…tributes' into must-be-variant-tests
...ono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/Sources/GlobalClass.GD0401.cs
Outdated
Show resolved
Hide resolved
…/TestData/Sources/GlobalClass.GD0401.cs
…-be-variant-tests # Conflicts: # modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/Sources/GlobalClass.GD0401.cs
...o/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/Sources/MustBeVariant.GD0301.cs
Outdated
Show resolved
Hide resolved
...o/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/Sources/MustBeVariant.GD0301.cs
Outdated
Show resolved
Hide resolved
new DiagnosticResult("GD0301", DiagnosticSeverity.Error) | ||
.WithSpan(MustBeVariantGD0301, 11, 16, 11, 22) | ||
.WithArguments(MustBeVariantGD0301) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the expected errors here is a bit difficult to visualize, I'd prefer inlining it in the source if possible like the syntax described in Tutorial: Write your first analyzer and code fix:
public void MethodCallsError()
{
// object is not Variant and Method<T> requires a generic type
{|GD0301:Method<object>();|}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I squashed the commits but I deleted the original branch in the process, as you can see in the history log... A new branch with exactly the same name and one single commit (with the {|GD0301:...|}
change requested) has been created. Not sure if this PR could be reopened again or I should create a new one from the same branch again, just let me know. Sorry for the mess! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I squashed the commits but I deleted the original branch in the process, as you can see in the history log... A new branch with exactly the same name and one single commit (with the
{|GD0301:...|}
change requested) has been created. Not sure if this PR could be reopened again or I should create a new one from the same branch again, just let me know. Sorry for the mess! :)
Hi @AThousandShips should I create a new PR? or could you please reopen this one with the same branch, which is already restored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't reopen this as the branch is deleted, maybe you can push to it again but otherwise I can't do anything here 🙂
I think a deleted branch can't be reopened in the system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a new one. Sorry for the mess: #86528
…/TestData/Sources/MustBeVariant.GD0301.cs Co-authored-by: Raul Santos <raulsntos@gmail.com>
…/TestData/Sources/MustBeVariant.GD0301.cs Co-authored-by: Raul Santos <raulsntos@gmail.com>
This PR adds test cases for the analyzers in the
Godot.SourceGenerators.Tests
project, following the same spirit as @paulloz did on #82955.