mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 00:04:10 -08:00
Merge pull request #36 from drxaos/master
Fix bug in AbstractStringBuilder.delete
This commit is contained in:
commit
2322a97d4c
|
@ -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