chore: Improve tests by inserting missing ↓ to have more precise assertions#898
Merged
chore: Improve tests by inserting missing ↓ to have more precise assertions#898
↓ to have more precise assertions#898Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves diagnostic precision in existing analyzer tests by inserting missing “↓” markers to explicitly indicate expected diagnostic locations.
- Added “↓” before target expressions or literals in various test attributes and code assertions.
- Ensures all test cases precisely mark where the analyzer should report diagnostics.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ValueSourceUsageAnalyzerTests.cs | Inserted “↓” before nameof and string literal arguments in [ValueSource] tests |
| TestMethodUsageAnalyzerTests.cs | Added “↓” before ExpectedResult in [TestCase] tests |
| TestCaseUsageAnalyzerTests.cs | Added “↓” before null in [TestCase] tests |
| TestCaseSourceUsesStringAnalyzerTests.cs | Inserted “↓” before nameof and string literals in [TestCaseSource] tests |
| TestCaseSourceSourceTypeTests.cs | Added “↓” before typeof in [TestCaseSource] tests |
| SomeItemsIncompatibleTypesAnalyzerTests.cs | Added “↓” before constraint usage in Assert.That(...Using...) test |
| DereferencePossiblyNullReferenceSuppressorTests.cs | Inserted “↓” before null-conditional and property access expressions in suppressor tests |
| EqualConstraintUsageCodeFixTests.cs | Added “↓” before raw boolean expressions in code-fix tests |
| EqualConstraintUsageAnalyzerTests.cs | Inserted “↓” before .Equals calls in analyzer tests |
| ConstActualValueUsageAnalyzerTests.cs | Added “↓” before string.Empty in classic-assert tests |
| LessOrEqualClassicModelAssertUsageCodeFixTests.cs | Inserted “↓” before ClassicAssert.LessOrEqual invocation |
| LessClassicModelAssertUsageCodeFixTests.cs | Added “↓” before ClassicAssert.Less invocation |
| GreaterOrEqualClassicModelAssertUsageCodeFixTests.cs | Added “↓” before ClassicAssert.GreaterOrEqual invocation |
| GreaterClassicModelAssertUsageCodeFixTests.cs | Added “↓” before ClassicAssert.Greater invocation |
manfred-brands
approved these changes
Jun 18, 2025
Member
manfred-brands
left a comment
There was a problem hiding this comment.
Thanks @mikkelbu
Looks sensible. If the were in the wrong spot, the build would have failed.
Is there any way we can fail the build if there is no ↓ in the source?
Member
Author
I don't think so (but I've not looked closely at Gu.Roslyn.Asserts, so I'll try to skim the code later) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #894