mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
csv: handle missing line ending
This commit is contained in:
parent
67a76cee1e
commit
4ea4d1c8c4
4 changed files with 136 additions and 45 deletions
11
vlib/encoding/csv/writer_test.v
Normal file
11
vlib/encoding/csv/writer_test.v
Normal file
|
@ -0,0 +1,11 @@
|
|||
import encoding.csv
|
||||
|
||||
fn test_encoding_csv_writer() {
|
||||
mut csv_writer := csv.new_writer()
|
||||
|
||||
csv_writer.write(['name', 'email', 'phone', 'other']) or {}
|
||||
csv_writer.write(['joe', 'joe@blow.com', '0400000000', 'test']) or {}
|
||||
csv_writer.write(['sam', 'sam@likesham.com', '0433000000', 'needs, quoting']) or {}
|
||||
|
||||
assert csv_writer.str() == 'name,email,phone,other\njoe,joe@blow.com,0400000000,test\nsam,sam@likesham.com,0433000000,"needs, quoting"\n'
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue