[ruby/psych] exception tests

1e9b79f699
This commit is contained in:
OrenGitHub 2025-04-29 08:22:11 +03:00 committed by git
parent 42328d4ef4
commit e2f5e233b5

View file

@ -82,6 +82,19 @@ module Psych
assert_equal 'omg!', ex.file
end
def test_safe_load_stream_takes_file
ex = assert_raise(Psych::SyntaxError) do
Psych.safe_load_stream '--- `'
end
assert_nil ex.file
assert_match '(<unknown>)', ex.message
ex = assert_raise(Psych::SyntaxError) do
Psych.safe_load_stream '--- `', filename: 'omg!'
end
assert_equal 'omg!', ex.file
end
def test_parse_file_exception
Tempfile.create(['parsefile', 'yml']) {|t|
t.binmode