summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Momchilov <alexander.momchilov@shopify.com>2022-07-22 16:09:26 -0400
committergit <svn-admin@ruby-lang.org>2022-08-09 01:33:32 +0900
commit38ea6b30dc409b43e4ac0758eeb352eecfb0d1da (patch)
treec2ccad77e5d1fbe025fc6219fa99bc398cd00489 /test
parentea1efdf32faf2cf35f6db1ec426c277bfa8f0461 (diff)
[ruby/psych] Add test for missing anchor
https://github.com/ruby/psych/commit/5f08137ae6
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_hash.rb11
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