summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Momchilov <alexander.momchilov@shopify.com>2022-07-22 16:09:26 -0400
committerAlexander Momchilov <alexander.momchilov@shopify.com>2022-07-27 15:25:26 -0400
commit5f08137ae6db1cdcea2e631f58a8d1bb4e73d340 (patch)
tree8e310967af94fe7b33ad8c3c5245e364d5048a05 /test
parent57e3b70a561fb7c822ab679b8e53e77a34ca94eb (diff)
downloadpsych-5f08137ae6db1cdcea2e631f58a8d1bb4e73d340.tar.gz
Add test for missing anchor
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 6c45da5..e5392dc 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