diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2020-11-12 11:04:06 -0500 |
---|---|---|
committer | Marc-Andre Lafortune <github@marc-andre.ca> | 2020-11-12 11:07:36 -0500 |
commit | 0210e310d04cbc9b236ccdde6caaf79aab4eb794 (patch) | |
tree | 23b545e39d29ae7740f2f625a3a8ef3d2e375304 /test/psych/test_exception.rb | |
parent | 67ecafb0e2aed5974adff45280080eab1e25656d (diff) | |
download | psych-0210e310d04cbc9b236ccdde6caaf79aab4eb794.zip |
Add `Psych.safe_load_file`. Tweak doc to provide `safe_` examples.
Diffstat (limited to 'test/psych/test_exception.rb')
-rw-r--r-- | test/psych/test_exception.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb index e355c26..78601d0 100644 --- a/test/psych/test_exception.rb +++ b/test/psych/test_exception.rb @@ -118,6 +118,18 @@ module Psych } end + def test_safe_load_file_exception + Tempfile.create(['loadfile', 'yml']) {|t| + t.binmode + t.write '--- `' + t.close + ex = assert_raises(Psych::SyntaxError) do + Psych.safe_load_file t.path + end + assert_equal t.path, ex.file + } + end + def test_psych_parse_takes_file ex = assert_raises(Psych::SyntaxError) do Psych.parse '--- `' |