diff options
author | Marcus Stollsteimer <sto.mar@web.de> | 2018-04-23 22:00:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-23 22:00:46 +0200 |
commit | 9dd18ddc1845952303c32a74b2778da3c943ec0b (patch) | |
tree | 8102eb32c92f17db9db6c57138fd7de0b9e304b8 | |
parent | 97af871d153371e8ae42ffb371897210e3cd084e (diff) | |
parent | 8fe50fcf2083bb36b845370ef090f58aebf669b3 (diff) | |
download | psych-9dd18ddc1845952303c32a74b2778da3c943ec0b.tar.gz |
Merge pull request #356 from stomar/fallback-tests
Add more test cases for fallback of Psych.load_file
-rw-r--r-- | test/psych/test_psych.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb index 2d4a7cc..bce6bf8 100644 --- a/test/psych/test_psych.rb +++ b/test/psych/test_psych.rb @@ -162,6 +162,24 @@ class TestPsych < Psych::TestCase } end + def test_load_file_with_fallback_for_nil + Tempfile.create(['nil', 'yml']) {|t| + t.binmode + t.write('--- null') + t.close + assert_nil Psych.load_file(t.path, fallback: 42) + } + end + + def test_load_file_with_fallback_for_false + Tempfile.create(['false', 'yml']) {|t| + t.binmode + t.write('--- false') + t.close + assert_equal false, Psych.load_file(t.path, fallback: 42) + } + end + def test_parse_file Tempfile.create(['yikes', 'yml']) {|t| t.binmode |