summaryrefslogtreecommitdiff
path: root/test/test_tempfile.rb
diff options
context:
space:
mode:
authorNAKAMURA Usaku <usa@ruby-lang.org>2019-05-01 17:38:09 +0900
committerNAKAMURA Usaku <usa@ruby-lang.org>2019-05-01 17:38:45 +0900
commitdcb6a6ae3e2b8a3e298e7f0d4a3e7f8ff102a30e (patch)
tree0bf466c25feb7f021d7dc881e59334c9f40f7080 /test/test_tempfile.rb
parentfc3e80cf6d8847fd5a2313dd7e2079d268f1ec84 (diff)
Windows simply causes an error to open invalid path
Diffstat (limited to 'test/test_tempfile.rb')
-rw-r--r--test/test_tempfile.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb
index 27263fca80..203059e41c 100644
--- a/test/test_tempfile.rb
+++ b/test/test_tempfile.rb
@@ -381,8 +381,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
@@ -390,6 +396,12 @@ 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!
end
@@ -399,6 +411,12 @@ puts Tempfile.new('foo').path
t = 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
ensure
if t
t.close