diff options
Diffstat (limited to 'test/psych/test_exception.rb')
-rw-r--r-- | test/psych/test_exception.rb | 13 |
1 files changed, 13 insertions, 0 deletions
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 '(<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 |