use of org.eclipse.wst.sse.core.internal.text.CharSequenceReader in project webtools.sourceediting by eclipse.
the class TestCharSequenceReader method testStandardBeginning.
public void testStandardBeginning() {
CharSequenceReader reader = new CharSequenceReader(fStandardString, 0, 3);
char char1 = (char) reader.read();
assertTrue(char1 == 't');
char char2 = (char) reader.read();
assertTrue(char2 == 'e');
char char3 = (char) reader.read();
assertTrue(char3 == 's');
int eof = reader.read();
assertTrue(eof == -1);
}
use of org.eclipse.wst.sse.core.internal.text.CharSequenceReader in project webtools.sourceediting by eclipse.
the class TestCharSequenceReader method testStandardMiddle.
public void testStandardMiddle() {
CharSequenceReader reader = new CharSequenceReader(fStandardString, 2, 3);
char char1 = (char) reader.read();
assertTrue(char1 == 's');
char char2 = (char) reader.read();
assertTrue(char2 == 't');
char char3 = (char) reader.read();
assertTrue(char3 == '1');
int eof = reader.read();
assertTrue(eof == -1);
}
use of org.eclipse.wst.sse.core.internal.text.CharSequenceReader in project webtools.sourceediting by eclipse.
the class TestCharSequenceReader method testBufferBegining.
public void testBufferBegining() throws IOException {
CharSequenceReader reader = new CharSequenceReader(fStandardString, 0, 3);
String targetString = "tes";
// intentionally small sized buffer
char[] charbuffer = new char[2];
StringBuffer stringBuffer = new StringBuffer();
int nRead = 0;
while (nRead != -1) {
nRead = reader.read(charbuffer);
if (nRead > 0) {
stringBuffer.append(charbuffer, 0, nRead);
}
}
String testString = stringBuffer.toString();
assertEquals(targetString, testString);
}
use of org.eclipse.wst.sse.core.internal.text.CharSequenceReader in project webtools.sourceediting by eclipse.
the class TestCharSequenceReader method testBufferEnd.
public void testBufferEnd() throws IOException {
CharSequenceReader reader = new CharSequenceReader(fStandardString, 4, 3);
String targetString = "123";
// intentionally small sized buffer
char[] charbuffer = new char[2];
StringBuffer stringBuffer = new StringBuffer();
int nRead = 0;
while (nRead != -1) {
nRead = reader.read(charbuffer);
if (nRead > 0) {
stringBuffer.append(charbuffer, 0, nRead);
}
}
String testString = stringBuffer.toString();
assertEquals(targetString, testString);
}
use of org.eclipse.wst.sse.core.internal.text.CharSequenceReader in project webtools.sourceediting by eclipse.
the class TestCharSequenceReader method testStandardOutOfRange.
public void testStandardOutOfRange() {
CharSequenceReader reader = new CharSequenceReader(fStandardString, 50, 3);
int eof = reader.read();
assertTrue(eof == -1);
}
Aggregations