diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_hash.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb index 3147076..4bd4edf 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) |