From e2f5e233b53208f032e9196cb3e411add1658853 Mon Sep 17 00:00:00 2001 From: OrenGitHub Date: Tue, 29 Apr 2025 08:22:11 +0300 Subject: [ruby/psych] exception tests https://github.com/ruby/psych/commit/1e9b79f699 --- test/psych/test_exception.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb index c1e69ab18d..6fd92abf9d 100644 --- a/test/psych/test_exception.rb +++ b/test/psych/test_exception.rb @@ -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 '()', 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 -- cgit v1.2.3