summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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