diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-08 18:58:47 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-08 18:58:57 -0700 |
commit | b199105ae8331d07d8036b2c3d41602699155d4c (patch) | |
tree | d9ad555e3ce248d682dbd8fd721b06c3da57c271 /test | |
parent | 81a8408b358df3710b7ebdd76bec99aeea3580ed (diff) | |
download | psych-b199105ae8331d07d8036b2c3d41602699155d4c.zip |
fixing Hash subclass dump and load support. fixes #14
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) |