-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
hutool-core/src/test/java/cn/hutool/core/text/csv/IssueIA8WE0Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package cn.hutool.core.text.csv; | ||
|
||
import cn.hutool.core.io.FileUtil; | ||
import cn.hutool.core.io.IoUtil; | ||
import org.junit.Test; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* https://gitee.com/dromara/hutool/issues/IA8WE0 | ||
*/ | ||
public class IssueIA8WE0Test { | ||
@Test | ||
public void csvReadTest() { | ||
final CsvReader csvReader = new CsvReader(); | ||
final CsvData read = csvReader.read(FileUtil.file("issueIA8WE0.csv")); | ||
final List<CsvRow> rows = read.getRows(); | ||
|
||
assertEquals(1, rows.size()); | ||
assertEquals(3, rows.get(0).size()); | ||
assertEquals("c1_text1", rows.get(0).get(0)); | ||
// 如果\n#出现在双引号中,表示实际的文本内容,并不算注释 | ||
assertEquals("c1_text2\n#c1_text2_line2", rows.get(0).get(1)); | ||
assertEquals("c1_text3", rows.get(0).get(2)); | ||
|
||
IoUtil.close(csvReader); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
c1_text1,"c1_text2 | ||
#c1_text2_line2",c1_text3 |