From 4dc29e295fd9fdff4fb20ab185def0bdd4d3a944 Mon Sep 17 00:00:00 2001 From: why Date: Thu, 15 Nov 2007 17:54:32 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/trunk@13940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/yaml/test_yaml.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb index 393cbd760..ce367713f 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__ -- cgit