summaryrefslogtreecommitdiff
path: root/test/csv/interface/test_read_write.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/csv/interface/test_read_write.rb')
-rw-r--r--test/csv/interface/test_read_write.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/csv/interface/test_read_write.rb b/test/csv/interface/test_read_write.rb
index 20c9fe317e..c371e9c5fc 100644
--- a/test/csv/interface/test_read_write.rb
+++ b/test/csv/interface/test_read_write.rb
@@ -112,4 +112,13 @@ a;b;c
assert_equal(CSV.instance,
CSV {|csv| csv})
end
+
+ def test_instance_shortcut_with_io
+ io = StringIO.new
+ from_instance = CSV.instance(io, col_sep: ";") { |csv| csv << ["a", "b", "c"] }
+ from_shortcut = CSV(io, col_sep: ";") { |csv| csv << ["e", "f", "g"] }
+
+ assert_equal(from_instance, from_shortcut)
+ assert_equal(from_instance.string, "a;b;c\ne;f;g\n")
+ end
end