diff options
author | Jim Kane <fastjames@gmail.com> | 2019-10-22 05:01:24 -0500 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-07-20 02:32:49 +0900 |
commit | b219cd5ac36ffb733e3eccd98d53ecf660dee5bf (patch) | |
tree | baed761723093ea3bfeb4ea92f063dad3a0145fb /test | |
parent | 9141aae8c2e2cf9ccf38a8c12828b284297c264b (diff) | |
download | ruby-b219cd5ac36ffb733e3eccd98d53ecf660dee5bf.tar.gz |
[ruby/csv] Make CSV::Row#dup return a usable Row (#108)
* Make CSV::Row#dup return a usable Row
Previously, calling `dup` on a `CSV::Row` object yielded an object whose
copy was too shallow. Changing the clone's fields would also change the
fields on the source. This change makes the clone more distinct from the
source, so that changes can be made to its fields without affecting the
source.
* Simplify
https://github.com/ruby/csv/commit/64a1ea06fc
Diffstat (limited to 'test')
-rw-r--r-- | test/csv/test_row.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb index f709dd3f13..b717945041 100644 --- a/test/csv/test_row.rb +++ b/test/csv/test_row.rb @@ -425,6 +425,9 @@ class TestCSVRow < Test::Unit::TestCase def test_dup row = CSV::Row.new(["A"], ["foo"]) dupped_row = row.dup + dupped_row["A"] = "bar" + assert_equal(["foo", "bar"], + [row["A"], dupped_row["A"]]) dupped_row.delete("A") assert_equal(["foo", nil], [row["A"], dupped_row["A"]]) |