aboutsummaryrefslogtreecommitdiffstats
path: root/test/psych/test_hash.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-09 01:58:07 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-09 01:58:07 +0000
commit8cd2bf072180a9f733ac06dbaa96f071ca8e8303 (patch)
tree3564682695ead10531a052423feea24ed18bb9a1 /test/psych/test_hash.rb
parentaaa52bf088d9f78d8e578ead12695a73639fc95a (diff)
downloadruby-8cd2bf072180a9f733ac06dbaa96f071ca8e8303.tar.gz
* ext/psych/lib/psych/visitors/to_ruby.rb: Hash subclasses can be read
from YAML files. * ext/psych/lib/psych/visitors/yaml_tree.rb: Hash subclasses can be dumped to YAML files. * test/psych/test_hash.rb: corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/test_hash.rb')
-rw-r--r--test/psych/test_hash.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb
index 3147076792..4bd4edfc8c 100644
--- a/test/psych/test_hash.rb
+++ b/test/psych/test_hash.rb
@@ -2,11 +2,25 @@ require 'psych/helper'
module Psych
class TestHash < TestCase
+ class X < Hash
+ end
+
def setup
super
@hash = { :a => 'b' }
end
+ def test_empty_subclass
+ assert_match "!ruby/hash:#{X}", Psych.dump(X.new)
+ x = Psych.load Psych.dump X.new
+ assert_equal X, x.class
+ end
+
+ def test_map
+ x = Psych.load "--- !map:#{X} { }\n"
+ assert_equal X, x.class
+ end
+
def test_self_referential
@hash['self'] = @hash
assert_cycle(@hash)