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 | e896e9b9f6073258e78f57299c0454b8e2fb5585 (patch) | |
tree | 23ef7d1736bb310d47762125e7e581afe259c220 /test | |
parent | de6b788fe937ddc30dd71c7e8457ec0c8adb449c (diff) | |
download | ruby-e896e9b9f6073258e78f57299c0454b8e2fb5585.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
Diffstat (limited to 'test')
-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) |