Skip to content

chore: Improve tests by inserting missing to have more precise assertions#898

Merged
mikkelbu merged 1 commit intomasterfrom
chore/improve-tests
Jun 18, 2025
Merged

chore: Improve tests by inserting missing to have more precise assertions#898
mikkelbu merged 1 commit intomasterfrom
chore/improve-tests

Conversation

@mikkelbu
Copy link
Copy Markdown
Member

Fixes #894

@mikkelbu mikkelbu requested a review from Copilot June 17, 2025 20:46
@mikkelbu mikkelbu added this to the Release 4.10 milestone Jun 17, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

@manfred-brands manfred-brands left a comment

Choose a reason for hiding this comment

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

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?

@mikkelbu
Copy link
Copy Markdown
Member Author

Is there any way we can fail the build if there is no ↓ in the source?

I don't think so (but I've not looked closely at Gu.Roslyn.Asserts, so I'll try to skim the code later)

@mikkelbu mikkelbu merged commit 10f6d45 into master Jun 18, 2025
7 checks passed
@mikkelbu mikkelbu deleted the chore/improve-tests branch June 18, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve tests by adding ↓ to tests were it is missing in the source

3 participants