mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix bug in AbstractStringBuilder.delete
This commit is contained in:
parent
19c18a41c5
commit
b02e9baeb8
|
@ -693,7 +693,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
|||
}
|
||||
|
||||
public TAbstractStringBuilder delete(int start, int end) {
|
||||
if (start > end || start >= length) {
|
||||
if (start > end || start > length) {
|
||||
throw new TStringIndexOutOfBoundsException();
|
||||
}
|
||||
if (start == end) {
|
||||
|
|
|
@ -310,6 +310,13 @@ public class StringBuilderTest {
|
|||
assertEquals('9', sb.charAt(7));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deletesNothing() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.delete(0, 0);
|
||||
assertEquals(0, sb.length());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void replacesRangeWithSequenceOfSameLength() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
Loading…
Reference in New Issue
Block a user