This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Adding test for StringBuilder.Clear() making sure Capacity wont grow unboundedly#28038
Merged
Merged
Conversation
danmoseley
reviewed
Mar 14, 2018
| [Theory] | ||
| [InlineData(1)] | ||
| [InlineData(10000)] | ||
| public static void Clear_AppendAndInsertBeforeClearManyTimes_CapacityStaysWithinRange(int times) |
Member
There was a problem hiding this comment.
You will need to disable this for .NET Framework
Member
There was a problem hiding this comment.
With a note of the issue # fixing it, and that on NETFX you end up with 100042
Contributor
There was a problem hiding this comment.
Suggestion: I would also add cases for the other possible outcomes of Clear (where we don't end up with ~1.2*Length of the original string)
danmoseley
approved these changes
Mar 14, 2018
Member
|
Please include link to CoreCLR fix in top comment |
Member
|
Consider checking there is a test for this not throwing. |
danmoseley
reviewed
Mar 19, 2018
| } | ||
|
|
||
| [Theory] | ||
| [InlineData(14)] |
Member
There was a problem hiding this comment.
Why use a Theory with only one value? That would normally be a fact, or you could add more data.
2d225f3 to
ac36217
Compare
ac36217 to
e2335c5
Compare
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
…unboundedly (dotnet/corefx#28038) * Adding test for StringBuilder.Clear making sure Capacity wont grow unboundedly. Fixes dotnet/corefx#27625 * Adding test for special case where the capacity corresponds to exactly chunk array size Commit migrated from dotnet/corefx@87dac23
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #27625
Tests for PR dotnet/coreclr#16926