Skip to content

Commit

Permalink
Add test for mac line breaks in text field
Browse files Browse the repository at this point in the history
  • Loading branch information
michaljurecko committed Jul 24, 2020
1 parent 86f03de commit f62f9c4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/CsvReadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ public function testParseEscapedBy()
self::assertEquals($expected, iterator_to_array($csvFile));
}

public function testParseMacLineEndsInField()
{
$csvFile = new CsvReader(__DIR__ . '/data/test-input.lineBreaks.csv', ",", '"', '\\');

$expected = [
[
'test',
"some text\rwith\r\\r line breaks\rinside\rbut\rrows\rare\rusing \\n \\\"line\\\" break\r",
],
[
'name', 'data'
]
];

self::assertEquals($expected, iterator_to_array($csvFile));
}


public function testEmptyHeader()
{
$csvFile = new CsvReader(__DIR__ . '/data/test-input.empty.csv', ',', '"');
Expand Down
2 changes: 2 additions & 0 deletions tests/data/test-input.lineBreaks.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"test","some textwith\r line breaksinsidebutrowsareusing \n \"line\" break"
"name","data"
Expand Down

0 comments on commit f62f9c4

Please sign in to comment.