commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1509957 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Date Sat, 03 Aug 2013 11:12:48 GMT
Author: britter
Date: Sat Aug  3 11:12:48 2013
New Revision: 1509957

URL: http://svn.apache.org/r1509957
Log:
Add some more tests that document escaping behavior

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=1509957&r1=1509956&r2=1509957&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 Sat Aug
 3 11:12:48 2013
@@ -305,29 +305,61 @@ public class CSVLexerTest {
     }
 
     @Test
+    public void testCR() throws Exception {
+        final Lexer lexer = getLexer("character" + CR + "Escaped", formatWithEscaping);
+        assertThat(lexer.nextToken(new Token()), hasContent("character"));
+        assertThat(lexer.nextToken(new Token()), hasContent("Escaped"));
+    }
+
+    @Test
     public void testEscapedLF() throws Exception {
         final Lexer lexer = getLexer("character\\" + LF + "Escaped", formatWithEscaping);
         assertThat(lexer.nextToken(new Token()), hasContent("character" + LF + "Escaped"));
     }
 
+    @Test
+    public void testLF() throws Exception {
+        final Lexer lexer = getLexer("character" + LF + "Escaped", formatWithEscaping);
+        assertThat(lexer.nextToken(new Token()), hasContent("character"));
+        assertThat(lexer.nextToken(new Token()), hasContent("Escaped"));
+    }
+
     @Test // TODO is this correct? Do we expect TAB to be un/escaped?
     public void testEscapedTab() throws Exception {
         final Lexer lexer = getLexer("character\\" + TAB + "Escaped", formatWithEscaping);
         assertThat(lexer.nextToken(new Token()), hasContent("character" + TAB + "Escaped"));
     }
 
+    @Test // TODO is this correct? Do we expect TAB to be un/escaped?
+    public void testTab() throws Exception {
+        final Lexer lexer = getLexer("character" + TAB + "Escaped", formatWithEscaping);
+        assertThat(lexer.nextToken(new Token()), hasContent("character" + TAB + "Escaped"));
+    }
+
     @Test // TODO is this correct? Do we expect BACKSPACE to be un/escaped?
     public void testEscapedBackspace() throws Exception {
         final Lexer lexer = getLexer("character\\" + BACKSPACE + "Escaped", formatWithEscaping);
         assertThat(lexer.nextToken(new Token()), hasContent("character" + BACKSPACE + "Escaped"));
     }
 
+    @Test // TODO is this correct? Do we expect BACKSPACE to be un/escaped?
+    public void testBackspace() throws Exception {
+        final Lexer lexer = getLexer("character" + BACKSPACE + "Escaped", formatWithEscaping);
+        assertThat(lexer.nextToken(new Token()), hasContent("character" + BACKSPACE + "Escaped"));
+    }
+
     @Test // TODO is this correct? Do we expect FF to be un/escaped?
     public void testEscapedFF() throws Exception {
         final Lexer lexer = getLexer("character\\" + FF + "Escaped", formatWithEscaping);
         assertThat(lexer.nextToken(new Token()), hasContent("character" + FF + "Escaped"));
     }
 
+    @Test // TODO is this correct? Do we expect FF to be un/escaped?
+    public void testFF() throws Exception {
+        final Lexer lexer = getLexer("character" + FF + "Escaped", formatWithEscaping);
+        assertThat(lexer.nextToken(new Token()), hasContent("character" + FF + "Escaped"));
+    }
+
     @Test
     public void testEscapedMySqlNullValue() throws Exception {
         // MySQL uses \N to symbolize null values. We have to restore this



Mime
View raw message