[#2252] Fix bug where AppendableCharSequence private constructor does not set correct position
This commit is contained in:
parent
918dd54a72
commit
8afc2cd378
@ -31,6 +31,7 @@ public final class AppendableCharSequence implements CharSequence, Appendable {
|
||||
|
||||
private AppendableCharSequence(char[] chars) {
|
||||
this.chars = chars;
|
||||
pos = chars.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,6 +57,13 @@ public class AppendableCharSequenceTest {
|
||||
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) {
|
||||
String text = "testdata";
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user