summaryrefslogtreecommitdiff
path: root/test/csv/test_interface.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 07:00:35 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-23 07:00:35 +0000
commite5d634260e7927db284fd7d2d656899443f5c53e (patch)
tree31f579715ae8c73ee8094c258b634f1186a0946a /test/csv/test_interface.rb
parentc20a1946a6d7b260f1f0f3038b7af081174d6cd9 (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-xtest/csv/test_interface.rb14
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