-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Use AsSpan/AsMemory (start, length) #45310
Conversation
Replace `AsSpan().Slice(start, length)` with `AsSpan(start, length)`
Replace `AsMemory().Slice(start, length)` with `AsMemory(start, length)`
src/libraries/System.Net.Security/tests/StressTests/SslStress/StressOperations.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/tests/StressTests/SslStress/StressOperations.cs
Outdated
Show resolved
Hide resolved
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.
Normally I'd suggest not making changes to unit test files, as we could inadvertently bypass legitimate tests. In the case of AsSpan.cs, there are unit tests that validate that AsSpan().Slice(...)
and AsSpan(...)
have the same result, and doing a search-and-replace of these patterns will end up essentially removing the value that such tests would've given us.
That said, it looks like in the case of GuidArrayAsSpanWithStartAndLength the test actually did intend to test AsSpan(...)
instead of AsSpan().Slice(...)
, if we're following the same pattern used by the other tests whose names end in the suffix *AsSpanWithStartAndLength.
But in the future please try to limit these changes to non-test code. Thanks!
Co-authored-by: Stephen Toub <[email protected]>
@GrabYourPitchforks These tests were not part of the merged changes? |
Yeah I did think twice about making these changes to tests, but in the case of GuidArrayAsSpanWithStartAndLength and others, they made sense. |
AsSpan().Slice(start, length)
withAsSpan(start, length)
AsMemory().Slice(start, length)
withAsMemory(start, length)