diff options
author | rm155 <[email protected]> | 2021-10-10 22:21:42 -0400 |
---|---|---|
committer | Sutou Kouhei <[email protected]> | 2021-10-24 05:57:33 +0900 |
commit | ee948fc1b4cb1ad382beee709008bb93b8f6ba75 (patch) | |
tree | 323e979f3c67259699d838228d28a0ea4fb3ac92 /test/csv/interface/test_write.rb | |
parent | 274882be62e5996d804e87103586feaeec381820 (diff) |
[ruby/csv] Add support for Ractor (https://github.com/ruby/csv/pull/218)
https://github.com/ruby/csv/commit/a802690e11
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5010
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] |