summaryrefslogtreecommitdiff
path: root/test/psych/test_object.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/psych/test_object.rb')
-rw-r--r--test/psych/test_object.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/psych/test_object.rb b/test/psych/test_object.rb
index 0faf6b244d..648a3ca6a5 100644
--- a/test/psych/test_object.rb
+++ b/test/psych/test_object.rb
@@ -41,5 +41,17 @@ module Psych
assert_instance_of(Foo, loaded)
assert_equal loaded, loaded.parent
end
+
+ def test_cyclic_reference_uses_alias
+ foo = Foo.new(nil)
+ foo.parent = foo
+
+ expected = <<~eoyaml
+ --- &1 !ruby/object:Psych::Foo
+ parent: *1
+ eoyaml
+
+ assert_equal expected, Psych.dump(foo)
+ end
end
end