Windows simply causes an error to open invalid path

This commit is contained in:
NAKAMURA Usaku 2019-05-01 17:38:09 +09:00
parent fc3e80cf6d
commit dcb6a6ae3e
No known key found for this signature in database
GPG Key ID: C5FE8AEA64F81259

View File

@ -381,8 +381,14 @@ puts Tempfile.new('foo').path
t = Tempfile.open([TRAVERSAL_PATH, 'foo']) t = Tempfile.open([TRAVERSAL_PATH, 'foo'])
actual = Dir.glob(TRAVERSAL_PATH + '*').count actual = Dir.glob(TRAVERSAL_PATH + '*').count
assert_equal expect, actual assert_equal expect, actual
rescue Errno::EINVAL
if /mswin|mingw/ =~ RUBY_PLATFORM
assert "ok"
else
raise $!
end
ensure ensure
t.close! t&.close!
end end
def test_new_traversal_dir def test_new_traversal_dir
@ -390,6 +396,12 @@ puts Tempfile.new('foo').path
t = Tempfile.new(TRAVERSAL_PATH + 'foo') t = Tempfile.new(TRAVERSAL_PATH + 'foo')
actual = Dir.glob(TRAVERSAL_PATH + '*').count actual = Dir.glob(TRAVERSAL_PATH + '*').count
assert_equal expect, actual assert_equal expect, actual
rescue Errno::EINVAL
if /mswin|mingw/ =~ RUBY_PLATFORM
assert "ok"
else
raise $!
end
ensure ensure
t&.close! t&.close!
end end
@ -399,6 +411,12 @@ puts Tempfile.new('foo').path
t = Tempfile.create(TRAVERSAL_PATH + 'foo') t = Tempfile.create(TRAVERSAL_PATH + 'foo')
actual = Dir.glob(TRAVERSAL_PATH + '*').count actual = Dir.glob(TRAVERSAL_PATH + '*').count
assert_equal expect, actual assert_equal expect, actual
rescue Errno::EINVAL
if /mswin|mingw/ =~ RUBY_PLATFORM
assert "ok"
else
raise $!
end
ensure ensure
if t if t
t.close t.close