[#2252] Fix bug where AppendableCharSequence private constructor does not set correct position
This commit is contained in:
parent
6513859a79
commit
6e1cee654f
@ -31,6 +31,7 @@ public final class AppendableCharSequence implements CharSequence, Appendable {
|
|||||||
|
|
||||||
private AppendableCharSequence(char[] chars) {
|
private AppendableCharSequence(char[] chars) {
|
||||||
this.chars = chars;
|
this.chars = chars;
|
||||||
|
pos = chars.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,6 +57,13 @@ public class AppendableCharSequenceTest {
|
|||||||
testAppendString0(new AppendableCharSequence(2));
|
testAppendString0(new AppendableCharSequence(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSubSequence() {
|
||||||
|
AppendableCharSequence master = new AppendableCharSequence(26);
|
||||||
|
master.append("abcdefghijlkmonpqrstuvwxyz");
|
||||||
|
assertEquals(master.subSequence(0, 10).toString(), "abcdefghij");
|
||||||
|
}
|
||||||
|
|
||||||
private static void testSimpleAppend0(AppendableCharSequence seq) {
|
private static void testSimpleAppend0(AppendableCharSequence seq) {
|
||||||
String text = "testdata";
|
String text = "testdata";
|
||||||
for (int i = 0; i < text.length(); i++) {
|
for (int i = 0; i < text.length(); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user