summaryrefslogtreecommitdiff
path: root/test/psych/test_hash.rb
diff options
context:
space:
mode:
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)