From d54f7b05e8b2e516451fb50c816cec311db570bf Mon Sep 17 00:00:00 2001 From: ocean Date: Mon, 16 Jan 2006 01:29:58 +0000 Subject: * ext/syck/emitter.c (syck_emit_seq, syck_emit_map, syck_emit_item): should output complex key mark even if map's key is empty seq/map. [ruby-core:7129] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/yaml/test_yaml.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb index 78a0877300..676310e6fc 100644 --- a/test/yaml/test_yaml.rb +++ b/test/yaml/test_yaml.rb @@ -1253,6 +1253,25 @@ EOY assert_cycle(NumericTest.new(3)) # Subclass of Numeric end + # + # Test empty map/seq in map cycle + # + def test_empty_map_key + # + # empty seq as key + # + o = YAML.load({[]=>""}.to_yaml) + assert_equal(Hash, o.class) + assert_equal([[]], o.keys) + + # + # empty map as key + # + o = YAML.load({{}=>""}.to_yaml) + assert_equal(Hash, o.class) + assert_equal([{}], o.keys) + end + end if $0 == __FILE__ -- cgit v1.2.3