summaryrefslogtreecommitdiff
path: root/test/yaml
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-15 17:54:32 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-15 17:54:32 +0000
commit2fb73a8b0a41460ab886989f4e2380b53ca0e016 (patch)
tree732726227046fe116074ba6b46289b7fafdf5769 /test/yaml
parent808becf9e0919d5e155be1574d364ada6046c111 (diff)
* lib/yaml.rb (quick_emit): use combination of object_id and hash to
identify repeated object references, since GC will reuse memory of objects during output of YAML. [ruby-Bugs-8548] [ruby-Bugs-3698] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/yaml')
-rw-r--r--test/yaml/test_yaml.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb
index 393cbd7..ce36771 100644
--- a/test/yaml/test_yaml.rb
+++ b/test/yaml/test_yaml.rb
@@ -1272,6 +1272,14 @@ EOY
assert_equal([{}], o.keys)
end
+ #
+ # contributed by riley lynch [ruby-Bugs-8548]
+ #
+ def test_object_id_collision
+ omap = YAML::Omap.new
+ 1000.times { |i| omap["key_#{i}"] = { "value" => i } }
+ raise "id collision in ordered map" if omap.to_yaml =~ /id\d+/
+ end
end
if $0 == __FILE__