File tree Expand file tree Collapse file tree 3 files changed +3
-22
lines changed
src/LinkDotNet.StringBuilder
tests/LinkDotNet.StringBuilder.UnitTests Expand file tree Collapse file tree 3 files changed +3
-22
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ All notable changes to **ValueStringBuilder** will be documented in this file. T
66
77## [ Unreleased]
88
9+ ### Changed
10+ - Remove unused defensive check in ` EnsureCapacity `
11+
912## [ 1.13.0] - 2023-03-04
1013
1114### Added
Original file line number Diff line number Diff line change @@ -159,11 +159,6 @@ public ValueStringBuilder(ReadOnlySpan<char> initialText)
159159 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
160160 public void EnsureCapacity ( int newCapacity )
161161 {
162- if ( newCapacity < 0 )
163- {
164- throw new ArgumentOutOfRangeException ( nameof ( newCapacity ) , "Capacity can't be negative." ) ;
165- }
166-
167162 if ( newCapacity > Length )
168163 {
169164 Grow ( newCapacity ) ;
Original file line number Diff line number Diff line change @@ -259,23 +259,6 @@ public void ShouldNotSetCapacityWhenSmallerThanCurrentString()
259259 builder . Length . Should ( ) . BeGreaterOrEqualTo ( 128 ) ;
260260 }
261261
262- [ Fact ]
263- public void ShouldThrowWhenNegativeValueInEnsureCapacity ( )
264- {
265- using var builder = new ValueStringBuilder ( ) ;
266- try
267- {
268- builder . EnsureCapacity ( - 1 ) ;
269- }
270- catch ( ArgumentOutOfRangeException )
271- {
272- Assert . True ( true ) ;
273- return ;
274- }
275-
276- Assert . False ( true ) ;
277- }
278-
279262 [ Fact ]
280263 public void ShouldFindLastOccurence ( )
281264 {
You can’t perform that action at this time.
0 commit comments