summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 06:17:42 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 06:17:42 +0000
commit9c38a08f2872f63076988ba8959e3b447cd4a8ce (patch)
tree84e909d750524fa0701aa053481eec6e01e98fbe /test/csv
parent2c69f7b278b782b2243fd9eec71264d4d7cab78c (diff)
Fixed to write_headers option behavior when given no rows.
[Bug #9988][ruby-core:63375] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv')
-rwxr-xr-xtest/csv/test_interface.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/csv/test_interface.rb b/test/csv/test_interface.rb
index 0ae03b0184..f2c774f606 100755
--- a/test/csv/test_interface.rb
+++ b/test/csv/test_interface.rb
@@ -295,6 +295,19 @@ class TestCSV::Interface < TestCSV
end
end
+ def test_write_headers_empty
+ File.unlink(@path)
+
+ CSV.open( @path, "wb", headers: "b|a|c",
+ write_headers: true,
+ col_sep: "|" ) do |csv|
+ end
+
+ File.open(@path, "rb") do |f|
+ assert_equal("b|a|c", f.gets.strip)
+ end
+ end
+
def test_append # aliased add_row() and puts()
File.unlink(@path)