diff options
author | Alexander Momchilov <alexander.momchilov@shopify.com> | 2022-07-27 10:19:37 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-08-09 01:31:24 +0900 |
commit | 71f89c287459d5ca313d0b1a16b7a743e0d71b8b (patch) | |
tree | cec765a3077ee3b37793517ae955fec538fd0d0b /test/psych/test_hash.rb | |
parent | 0b7cfdca09651f2eae5cd0e8ae4efed5033493f2 (diff) |
[ruby/psych] Don't hardcode expected alias names
https://github.com/ruby/psych/commit/b9ab19094f
Diffstat (limited to 'test/psych/test_hash.rb')
-rw-r--r-- | test/psych/test_hash.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb index 43e4b8bf14..0555f6e034 100644 --- a/test/psych/test_hash.rb +++ b/test/psych/test_hash.rb @@ -112,16 +112,22 @@ eoyml assert_equal({"foo"=>{"hello"=>"world"}, "bar"=>{"hello"=>"world"}}, hash) end - def test_recursive_hash_uses_alias + def test_recursive_hash h = { } h["recursive_reference"] = h - expected = <<~eoyaml - --- &1 - recursive_reference: *1 - eoyaml + loaded = Psych.load(Psych.dump(h), aliases: true) + + assert_same loaded, loaded.fetch("recursive_reference") + end + + def test_recursive_hash_uses_alias + h = { } + h["recursive_reference"] = h - assert_equal(expected, Psych.dump(h)) + assert_raise(BadAlias) do + Psych.load(Psych.dump(h), aliases: false) + end end def test_key_deduplication |