1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
sorah 2017-08-31 15:41:54 +00:00
parent de6b788fe9
commit e896e9b9f6

View file

@ -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)