You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2013/04/10 19:47:42 UTC

svn commit: r1466590 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java

Author: britter
Date: Wed Apr 10 17:47:42 2013
New Revision: 1466590

URL: http://svn.apache.org/r1466590
Log:
Add a test that makes sure ignoreSurroundingWhitespaces works for the tab character

Modified:
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1466590&r1=1466589&r2=1466590&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java Wed Apr 10 17:47:42 2013
@@ -71,6 +71,19 @@ public class CSVLexerTest {
     }
 
     @Test
+    public void testSurroundingTabsAreDeleted() throws IOException {
+        final String code = "noTabs,\tleadingTab,trailingTab\t,\tsurroundingTabs\t,\t\t,,";
+        final Lexer parser = getLexer(code, CSVFormat.newBuilder().withIgnoreSurroundingSpaces(true).build());
+        assertThat(parser.nextToken(new Token()), matches(TOKEN, "noTabs"));
+        assertThat(parser.nextToken(new Token()), matches(TOKEN, "leadingTab"));
+        assertThat(parser.nextToken(new Token()), matches(TOKEN, "trailingTab"));
+        assertThat(parser.nextToken(new Token()), matches(TOKEN, "surroundingTabs"));
+        assertThat(parser.nextToken(new Token()), matches(TOKEN, ""));
+        assertThat(parser.nextToken(new Token()), matches(TOKEN, ""));
+        assertThat(parser.nextToken(new Token()), matches(EOF, ""));
+    }
+
+    @Test
     public void testIgnoreEmptyLines() throws IOException {
         final String code =
                 "first,line,\n"+