diff options
author | Alexander Momchilov <alexander.momchilov@shopify.com> | 2022-07-22 16:09:26 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-08-09 01:33:32 +0900 |
commit | 38ea6b30dc409b43e4ac0758eeb352eecfb0d1da (patch) | |
tree | c2ccad77e5d1fbe025fc6219fa99bc398cd00489 | |
parent | ea1efdf32faf2cf35f6db1ec426c277bfa8f0461 (diff) | |
download | ruby-38ea6b30dc409b43e4ac0758eeb352eecfb0d1da.tar.gz |
[ruby/psych] Add test for missing anchor
https://github.com/ruby/psych/commit/5f08137ae6
-rw-r--r-- | test/psych/test_hash.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb index 6c45da53b7..e5392dc4d9 100644 --- a/test/psych/test_hash.rb +++ b/test/psych/test_hash.rb @@ -123,6 +123,17 @@ eoyml assert_same(hash.fetch("foo"), hash.fetch("bar")) end + def test_raises_if_anchor_not_defined + assert_raise(Psych::BadAlias) do + Psych.unsafe_load(<<~eoyml) + --- + foo: &foo + hello: world + bar: *not_foo + eoyml + end + end + def test_recursive_hash h = { } h["recursive_reference"] = h |