Skip to content

Commit b05af3c

Browse files
committed
Add a test that makes sure ignoreSurroundingWhitespaces works for the tab character
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1466590 13f79535-47bb-0310-9956-ffa450edef68
1 parent a7e4484 commit b05af3c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/test/java/org/apache/commons/csv/CSVLexerTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ public void testIgnoreSurroundingSpacesAreDeleted() throws IOException {
7070
assertThat(parser.nextToken(new Token()), matches(EOF, ""));
7171
}
7272

73+
@Test
74+
public void testSurroundingTabsAreDeleted() throws IOException {
75+
final String code = "noTabs,\tleadingTab,trailingTab\t,\tsurroundingTabs\t,\t\t,,";
76+
final Lexer parser = getLexer(code, CSVFormat.newBuilder().withIgnoreSurroundingSpaces(true).build());
77+
assertThat(parser.nextToken(new Token()), matches(TOKEN, "noTabs"));
78+
assertThat(parser.nextToken(new Token()), matches(TOKEN, "leadingTab"));
79+
assertThat(parser.nextToken(new Token()), matches(TOKEN, "trailingTab"));
80+
assertThat(parser.nextToken(new Token()), matches(TOKEN, "surroundingTabs"));
81+
assertThat(parser.nextToken(new Token()), matches(TOKEN, ""));
82+
assertThat(parser.nextToken(new Token()), matches(TOKEN, ""));
83+
assertThat(parser.nextToken(new Token()), matches(EOF, ""));
84+
}
85+
7386
@Test
7487
public void testIgnoreEmptyLines() throws IOException {
7588
final String code =

0 commit comments

Comments
 (0)