mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* lib/csv.rb: Incorporating the fixes from the recent
FasterCSV releases: 1.5.2 and 1.5.3. [ruby-core:25038] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0471422beb
commit
1bd1128989
5 changed files with 115 additions and 89 deletions
|
@ -75,6 +75,11 @@ class TestCSVInterface < Test::Unit::TestCase
|
|||
assert_equal(%w{1 2 3}, row)
|
||||
end
|
||||
|
||||
def test_parse_line_with_empty_lines
|
||||
assert_equal(nil, CSV.parse_line("")) # to signal eof
|
||||
assert_equal(Array.new, CSV.parse_line("\n1,2,3"))
|
||||
end
|
||||
|
||||
def test_read_and_readlines
|
||||
assert_equal( @expected,
|
||||
CSV.read(@path, col_sep: "\t", row_sep: "\r\n") )
|
||||
|
@ -167,7 +172,7 @@ class TestCSVInterface < Test::Unit::TestCase
|
|||
csv << lines.first.keys
|
||||
lines.each { |line| csv << line }
|
||||
end
|
||||
CSV.open( @path, "w", headers: true,
|
||||
CSV.open( @path, "r", headers: true,
|
||||
converters: :all,
|
||||
header_converters: :symbol ) do |csv|
|
||||
csv.each { |line| assert_equal(lines.shift, line.to_hash) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue