diff options
author | Alexander Momchilov <alexander.momchilov@shopify.com> | 2022-07-22 16:45:03 -0400 |
---|---|---|
committer | Alexander Momchilov <alexander.momchilov@shopify.com> | 2022-07-22 16:57:54 -0400 |
commit | d9f7289190d424981555dec9f2c019f6a270f205 (patch) | |
tree | 98503a87db510bc0139a7dfefb2870485f4c1d54 /test/psych/test_hash.rb | |
parent | 0bc30cb4cb03164fb60cab7f0d2eb27fd6e78193 (diff) | |
download | psych-d9f7289190d424981555dec9f2c019f6a270f205.tar.gz |
Test that recursive refs dump as aliases
Diffstat (limited to 'test/psych/test_hash.rb')
-rw-r--r-- | test/psych/test_hash.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb index 5374781..43e4b8b 100644 --- a/test/psych/test_hash.rb +++ b/test/psych/test_hash.rb @@ -112,6 +112,18 @@ eoyml assert_equal({"foo"=>{"hello"=>"world"}, "bar"=>{"hello"=>"world"}}, hash) end + def test_recursive_hash_uses_alias + h = { } + h["recursive_reference"] = h + + expected = <<~eoyaml + --- &1 + recursive_reference: *1 + eoyaml + + assert_equal(expected, Psych.dump(h)) + end + def test_key_deduplication unless String.method_defined?(:-@) && (-("a" * 20)).equal?((-("a" * 20))) pend "This Ruby implementation doesn't support string deduplication" |