Don't detect comments except at start of a line

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1306422 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-03-28 15:31:20 +00:00
parent a708256b65
commit 22af43218a
1 changed files with 4 additions and 4 deletions

View File

@ -58,10 +58,10 @@ public class CSVLexerTest {
public void testNextToken2() throws IOException {
final String code =
"1,2,3,\n"+
"a,b x,c\n"+
"a,b x,c#no-comment\n"+
"#foo\n"+
"\n"+
"d,e,\n"+
"d,e,#no-comment\n"+
"\n";
CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#');
@ -74,12 +74,12 @@ public class CSVLexerTest {
assertTokenEquals(EORECORD, "", parser.nextToken(new Token()));
assertTokenEquals(TOKEN, "a", parser.nextToken(new Token()));
assertTokenEquals(TOKEN, "b x", parser.nextToken(new Token()));
assertTokenEquals(EORECORD, "c", parser.nextToken(new Token()));
assertTokenEquals(EORECORD, "c#no-comment", parser.nextToken(new Token()));
assertTokenEquals(COMMENT, "", parser.nextToken(new Token()));
assertTokenEquals(EORECORD, "", parser.nextToken(new Token()));
assertTokenEquals(TOKEN, "d", parser.nextToken(new Token()));
assertTokenEquals(TOKEN, "e", parser.nextToken(new Token()));
assertTokenEquals(EORECORD, "", parser.nextToken(new Token()));
assertTokenEquals(EORECORD, "#no-comment", parser.nextToken(new Token()));
assertTokenEquals(EOF, "", parser.nextToken(new Token()));
assertTokenEquals(EOF, "", parser.nextToken(new Token()));