CSV-75 ExtendedBufferReader does not handle EOL consistently

Fix tests

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1305695 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-03-27 00:54:36 +00:00
parent de1838ea06
commit 8a683f009d
1 changed files with 5 additions and 9 deletions

View File

@ -70,12 +70,12 @@ public class ExtendedBufferedReaderTest {
assertEquals('3', br.readAgain());
assertEquals('\n', br.lookAhead());
assertEquals(1, br.getLineNumber()); // will need fixing for CSV-75
assertEquals(2, br.getLineNumber());
assertEquals('3', br.readAgain());
assertEquals('\n', br.read());
assertEquals(2, br.getLineNumber()); // will need fixing for CSV-75
assertEquals(3, br.getLineNumber());
assertEquals('\n', br.readAgain());
assertEquals(2, br.getLineNumber()); // will need fixing for CSV-75
assertEquals(3, br.getLineNumber());
assertEquals(ExtendedBufferedReader.END_OF_STREAM, br.lookAhead());
assertEquals('\n', br.readAgain());
@ -152,16 +152,12 @@ public class ExtendedBufferedReaderTest {
/*
* Test to illustrate https://issues.apache.org/jira/browse/CSV-75
*
* TODO fix checks when code is fixed
*/
@Test
public void testReadChar() throws Exception {
String LF="\n"; String CR="\r"; String CRLF=CR+LF; String LFCR=LF+CR;// easier to read the string below
String test="a" + LF + "b" + CR + "c" + LF + LF + "d" + CR + CR + "e" + LFCR + "f "+ CRLF;
// EOL eol EOL EOL eol eol EOL+CR EOL
// EOL = current EOL behaviour with read() methods
// eol = additional behaviour with readLine()
final int EOLct=5;
final int EOLeolct=9;
ExtendedBufferedReader br;
@ -173,13 +169,13 @@ public class ExtendedBufferedReaderTest {
br = getBufferedReader(test);
assertEquals(0, br.getLineNumber());
while(br.read()!=-1) {}
assertEquals(EOLct, br.getLineNumber()); // will need fixing for CSV-75
assertEquals(EOLeolct, br.getLineNumber());
br = getBufferedReader(test);
assertEquals(0, br.getLineNumber());
char[] buff = new char[10];
while(br.read(buff ,0, 3)!=-1) {}
assertEquals(EOLct, br.getLineNumber()); // will need fixing for CSV-75
assertEquals(EOLeolct, br.getLineNumber());
}
private ExtendedBufferedReader getBufferedReader(String s) {