diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-12-20 09:32:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-20 09:32:21 +0900 |
commit | 39b1e826d2e505fb35022fd9bf4f3a6dc0ee5702 (patch) | |
tree | 1940ae79572a9bfa1a956bafbf71e10607b30839 /test | |
parent | dd8bb41f60c64b4128ca0a2c91a38ae86adccc0e (diff) | |
parent | 1f2eb4b7b968f0f1f7083f167d3e35a1fe254cdc (diff) | |
download | psych-39b1e826d2e505fb35022fd9bf4f3a6dc0ee5702.zip |
Merge pull request #345 from stomar/fallback-tests
Add more test cases for fallback of Psych.load_file
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/test_psych.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb index 2812fd1..2d4a7cc 100644 --- a/test/psych/test_psych.rb +++ b/test/psych/test_psych.rb @@ -144,8 +144,20 @@ class TestPsych < Psych::TestCase } end + def test_load_file_default_return_value + Tempfile.create(['empty', 'yml']) {|t| + assert_equal false, Psych.load_file(t.path) + } + end + def test_load_file_with_fallback Tempfile.create(['empty', 'yml']) {|t| + assert_equal 42, Psych.load_file(t.path, fallback: 42) + } + end + + def test_load_file_with_fallback_hash + Tempfile.create(['empty', 'yml']) {|t| assert_equal Hash.new, Psych.load_file(t.path, fallback: Hash.new) } end |