aboutsummaryrefslogtreecommitdiffstats
path: root/test/psych
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-05 19:15:40 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-05 19:15:40 +0000
commit9ae2651d1929891a443eb6a208fb1038c23b86e0 (patch)
treee3de90b082f45e963a3a196708cdad260a8abf02 /test/psych
parent7835e321ea05b3176f05f9840b7082b4378edc62 (diff)
downloadruby-9ae2651d1929891a443eb6a208fb1038c23b86e0.tar.gz
* ext/psych/lib/psych/visitors/to_ruby.rb: process merge keys before
reviving objects. Fixes GH psych #168 * test/psych/test_merge_keys.rb: test for change https://github.com/tenderlove/psych/issues/168 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r--test/psych/test_merge_keys.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/psych/test_merge_keys.rb b/test/psych/test_merge_keys.rb
index d8baba485f..ba8d2e77b3 100644
--- a/test/psych/test_merge_keys.rb
+++ b/test/psych/test_merge_keys.rb
@@ -2,6 +2,24 @@ require_relative 'helper'
module Psych
class TestMergeKeys < TestCase
+ class Product
+ attr_reader :bar
+ end
+
+ def test_mergekey_with_object
+ s = <<-eoyml
+foo: &foo
+ bar: 10
+product:
+ !ruby/object:#{Product.name}
+ <<: *foo
+ eoyml
+ hash = Psych.load s
+ assert_equal({"bar" => 10}, hash["foo"])
+ product = hash["product"]
+ assert_equal 10, product.bar
+ end
+
def test_merge_nil
yaml = <<-eoyml
defaults: &defaults