From dcb6a6ae3e2b8a3e298e7f0d4a3e7f8ff102a30e Mon Sep 17 00:00:00 2001 From: NAKAMURA Usaku Date: Wed, 1 May 2019 17:38:09 +0900 Subject: Windows simply causes an error to open invalid path --- test/test_tempfile.rb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test/test_tempfile.rb') 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 -- cgit v1.2.3