diff options
Diffstat (limited to 'test/csv/interface/test_write.rb')
-rw-r--r-- | test/csv/interface/test_write.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/csv/interface/test_write.rb b/test/csv/interface/test_write.rb index 8650ecd624..02c2c5c5ce 100644 --- a/test/csv/interface/test_write.rb +++ b/test/csv/interface/test_write.rb @@ -25,6 +25,21 @@ class TestCSVInterfaceWrite < Test::Unit::TestCase CSV end + if respond_to?(:ractor) + ractor + def test_generate_default_in_ractor + ractor = Ractor.new do + CSV.generate do |csv| + csv << [1, 2, 3] << [4, nil, 5] + end + end + assert_equal(<<-CSV, ractor.take) +1,2,3 +4,,5 + CSV + end + end + def test_generate_append csv_text = <<-CSV 1,2,3 @@ -101,6 +116,25 @@ a,b,c CSV end + + if respond_to?(:ractor) + ractor + def test_append_row_in_ractor + ractor = Ractor.new(@output.path) do |path| + CSV.open(path, "wb") do |csv| + csv << + CSV::Row.new([], ["1", "2", "3"]) << + CSV::Row.new([], ["a", "b", "c"]) + end + end + ractor.take + assert_equal(<<-CSV, File.read(@output.path, mode: "rb")) +1,2,3 +a,b,c + CSV + end + end + def test_append_hash CSV.open(@output.path, "wb", headers: true) do |csv| csv << [:a, :b, :c] |