We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c11ddc commit 57e3b70Copy full SHA for 57e3b70
test/psych/test_hash.rb
@@ -112,6 +112,17 @@ def test_ref_append
112
assert_equal({"foo"=>{"hello"=>"world"}, "bar"=>{"hello"=>"world"}}, hash)
113
end
114
115
+ def test_anchor_reuse
116
+ hash = Psych.unsafe_load(<<~eoyml)
117
+ ---
118
+ foo: &foo
119
+ hello: world
120
+ bar: *foo
121
+ eoyml
122
+ assert_equal({"foo"=>{"hello"=>"world"}, "bar"=>{"hello"=>"world"}}, hash)
123
+ assert_same(hash.fetch("foo"), hash.fetch("bar"))
124
+ end
125
+
126
def test_recursive_hash
127
h = { }
128
h["recursive_reference"] = h
0 commit comments