[#2252] Fix bug where AppendableCharSequence private constructor does not set correct position

This commit is contained in:
Jatinder 2014-03-03 17:16:59 +05:30 committed by Norman Maurer
parent 6513859a79
commit 6e1cee654f
2 changed files with 8 additions and 0 deletions

View File

@ -31,6 +31,7 @@ public final class AppendableCharSequence implements CharSequence, Appendable {
private AppendableCharSequence(char[] chars) {
this.chars = chars;
pos = chars.length;
}
@Override

View File

@ -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++) {