summaryrefslogtreecommitdiffstats
path: root/test/yaml
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-16 01:29:58 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-16 01:29:58 +0000
commit3e967aed58d3e1b97287c238ca80ccd712a96943 (patch)
tree5279446ef37d5edd33566f25c046ce7532ebf1a6 /test/yaml
parent144dd373cdafde21d5dc47716df9f903bcc87b23 (diff)
downloadruby-3e967aed58d3e1b97287c238ca80ccd712a96943.tar.gz
ruby-3e967aed58d3e1b97287c238ca80ccd712a96943.tar.xz
ruby-3e967aed58d3e1b97287c238ca80ccd712a96943.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@9835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/yaml')
-rw-r--r--test/yaml/test_yaml.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb
index 78a087730..676310e6f 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__