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:
parent
de6b788fe9
commit
e896e9b9f6
1 changed files with 11 additions and 5 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue