-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Improve ConcurrentDictionary test coverage by asserting callback arguments #123599
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 ConcurrentDictionary test coverage by asserting callback arguments #123599
Conversation
…in AddOrUpdate updateValueFactory Co-authored-by: stephentoub <[email protected]>
...raries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionaryTests.cs
Outdated
Show resolved
Hide resolved
…rameters Co-authored-by: stephentoub <[email protected]>
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.
Pull request overview
This PR improves test coverage for ConcurrentDictionary.AddOrUpdate by ensuring that the updateValueFactory delegate's parameters are properly tested. The change modifies a lambda expression in the TestGetOrAddOrUpdate test method to use its old value argument instead of ignoring it.
Changes:
- Modified the lambda in case 0 of the AddOrUpdate test to use the old value parameter
vinstead of ignoring it and using the captured variable-j
…nd AddOrUpdate tests Co-authored-by: stephentoub <[email protected]>
...raries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionaryTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: stephentoub <[email protected]>
stephentoub
left a comment
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.
LGTM if CI passes
|
/ba-g timeout |
Description
The
TestGetOrAddOrUpdatetest wasn't fully exercising the callback delegates inGetOrAddandAddOrUpdateoverloads. The lambdas either ignored their arguments or used them without verifying correctness, meaning a bug in how arguments are passed to the delegates would go undetected.Added explicit assertions inside all callbacks to verify that the correct values are passed:
GetOrAdd callbacks:
AddOrUpdate callbacks:
This ensures that if there was a bug where any callback argument wasn't properly passed, the test would catch it with an explicit assertion failure.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.