diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-23 07:00:35 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-23 07:00:35 +0000 |
commit | e5d634260e7927db284fd7d2d656899443f5c53e (patch) | |
tree | 31f579715ae8c73ee8094c258b634f1186a0946a /test/csv/test_interface.rb | |
parent | c20a1946a6d7b260f1f0f3038b7af081174d6cd9 (diff) |
Import CSV 3.0.2
This includes performance improvement especially writing. Writing is
about 2 times faster.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv/test_interface.rb')
-rwxr-xr-x | test/csv/test_interface.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/csv/test_interface.rb b/test/csv/test_interface.rb index 912e2ec7f5..309fbbb87b 100755 --- a/test/csv/test_interface.rb +++ b/test/csv/test_interface.rb @@ -139,6 +139,18 @@ class TestCSV::Interface < TestCSV assert_equal(Array.new, CSV.parse_line("\n1,2,3")) end + def test_parse_header_only + table = CSV.parse("a,b,c", headers: true) + assert_equal([ + ["a", "b", "c"], + [], + ], + [ + table.headers, + table.each.to_a, + ]) + end + def test_read_and_readlines assert_equal( @expected, CSV.read(@path, col_sep: "\t", row_sep: "\r\n") ) @@ -236,7 +248,7 @@ class TestCSV::Interface < TestCSV CSV.open(@path, "w", headers: true) do |csv| csv << headers csv << %w{1 2 3} - assert_equal(headers, csv.instance_variable_get(:@headers)) + assert_equal(headers, csv.headers) end end |