diff options
author | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-31 15:41:54 +0000 |
---|---|---|
committer | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-31 15:41:54 +0000 |
commit | 71f6ab48e6c1ad0decb635e0de181b4722577c06 (patch) | |
tree | 23ef7d1736bb310d47762125e7e581afe259c220 | |
parent | 2822a7427761477ba0101da66977e92479a5438d (diff) | |
download | ruby-71f6ab48e6c1ad0decb635e0de181b4722577c06.tar.gz |
Skip test_open_tempfile_path on EINVAL
Looks like File::Constants::TMPFILE could be defined even when not
supported on system. Just skip the test when we get EINVAL on open(2).
* test/ruby/test_file.rb(test_open_tempfile_path):
Skip when EINVAL occured on File.open.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_file.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index bb366ce81f..a184d3403c 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -471,12 +471,18 @@ class TestFile < Test::Unit::TestCase def test_open_tempfile_path Dir.mktmpdir(__method__.to_s) do |tmpdir| - File.open(tmpdir, File::RDWR | File::TMPFILE) do |io| - io.write "foo" - io.flush - assert_equal 3, io.size - assert_raise(IOError) { io.path } + begin + io = File.open(tmpdir, File::RDWR | File::TMPFILE) + rescue Errno::EINVAL + skip 'O_TMPFILE not supported (EINVAL)' end + + io.write "foo" + io.flush + assert_equal 3, io.size + assert_raise(IOError) { io.path } + ensure + io&.close end end if File::Constants.const_defined?(:TMPFILE) |