diff options
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 |