diff options
| author | OrenGitHub <tuna.is.good.for.you@gmail.com> | 2025-04-29 08:22:11 +0300 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-05-09 17:53:18 +0000 |
| commit | e2f5e233b53208f032e9196cb3e411add1658853 (patch) | |
| tree | 2eb23b9c7e89a1ea6e74816f37ca0f40b14d5da3 /test | |
| parent | 42328d4ef447b71f952a8b3a6e9850b4f827b7ea (diff) | |
[ruby/psych] exception tests
https://github.com/ruby/psych/commit/1e9b79f699
Diffstat (limited to 'test')
| -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 |
