aboutsummaryrefslogtreecommitdiffstats
path: root/test/csv/test_row.rb
diff options
context:
space:
mode:
authorjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-24 00:44:41 +0000
committerjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-24 00:44:41 +0000
commit895e9b0acd986cf3dba7df60fb00c5ca3607c844 (patch)
tree77fc34aee486de9e092b82b7427d8d7f461b2128 /test/csv/test_row.rb
parent34176b023eb42478bad22481d90d6223b5a31d48 (diff)
downloadruby-895e9b0acd986cf3dba7df60fb00c5ca3607c844.tar.gz
* lib/csv.rb: Optimize header hashes by freezing string keys.
[ruby-core:58510] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv/test_row.rb')
-rwxr-xr-xtest/csv/test_row.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb
index 697c7d56c8..a097fc7200 100755
--- a/test/csv/test_row.rb
+++ b/test/csv/test_row.rb
@@ -297,7 +297,12 @@ class TestCSV::Row < TestCSV
end
def test_to_hash
- assert_equal({"A" => nil, "B" => 2, "C" => 3}, @row.to_hash)
+ hash = @row.to_hash
+ assert_equal({"A" => nil, "B" => 2, "C" => 3}, hash)
+ hash.keys.each_with_index do |string_key, h|
+ assert_predicate(string_key, :frozen?)
+ assert_same(string_key, @row.headers[h])
+ end
end
def test_to_csv