summaryrefslogtreecommitdiff
path: root/test/test_tempfile.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-05-30 09:14:41 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-05-30 09:14:41 +0000
commit39ee412b14cbd60e108a2de62715c254f41f6bb2 (patch)
tree93c35cec802fc9c3c2c546013f9a0df662da5432 /test/test_tempfile.rb
parent6610b77ea85302e33d8cb0a2a082f8bd2b3e2f40 (diff)
merge revision(s) dcb6a6ae3e2b8a3e298e7f0d4a3e7f8ff102a30e:[Backport #15845]
Windows simply causes an error to open invalid path git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_tempfile.rb')
-rw-r--r--test/test_tempfile.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb
index 6b7860fe20..fb1027ba78 100644
--- a/test/test_tempfile.rb
+++ b/test/test_tempfile.rb
@@ -379,8 +379,14 @@ puts Tempfile.new('foo').path
t = Tempfile.open([TRAVERSAL_PATH, 'foo'])
actual = Dir.glob(TRAVERSAL_PATH + '*').count
assert_equal expect, actual
+ rescue Errno::EINVAL
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ assert "ok"
+ else
+ raise $!
+ end
ensure
- t.close!
+ t&.close!
end
def test_new_traversal_dir
@@ -388,8 +394,14 @@ puts Tempfile.new('foo').path
t = Tempfile.new(TRAVERSAL_PATH + 'foo')
actual = Dir.glob(TRAVERSAL_PATH + '*').count
assert_equal expect, actual
+ rescue Errno::EINVAL
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ assert "ok"
+ else
+ raise $!
+ end
ensure
- t.close!
+ t&.close!
end
def test_create_traversal_dir
@@ -397,5 +409,11 @@ puts Tempfile.new('foo').path
Tempfile.create(TRAVERSAL_PATH + 'foo')
actual = Dir.glob(TRAVERSAL_PATH + '*').count
assert_equal expect, actual
+ rescue Errno::EINVAL
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ assert "ok"
+ else
+ raise $!
+ end
end
end