From 7128849c8c5fce8df450379db54136fd21fab6ad Mon Sep 17 00:00:00 2001 From: k0kubun Date: Fri, 24 Nov 2017 12:37:07 +0000 Subject: test_workspace.rb: skip test failing on windows > Note that all files are always readable > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/chmod-wchmod It seems that we can't make a file unreadable with `File.chmod` on Windows. When file can't be read, File::EACCES is raised on Windows too. So r60900 should work anyway, but I don't know how to let it happen by Ruby code. I tried to open file before reading it, but I couldn't reproduce File::EACCES too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/irb/test_workspace.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'test/irb/test_workspace.rb') diff --git a/test/irb/test_workspace.rb b/test/irb/test_workspace.rb index 970dc7fd14..d67b9f6713 100644 --- a/test/irb/test_workspace.rb +++ b/test/irb/test_workspace.rb @@ -32,16 +32,18 @@ module TestIRB end end - def test_code_around_binding_with_existing_unreadable_file - Tempfile.create do |f| - code = "IRB::WorkSpace.new(binding)\n" - f.print(code) - f.close + unless /mswin|mingw/ =~ RUBY_PLATFORM + def test_code_around_binding_with_existing_unreadable_file + Tempfile.create do |f| + code = "IRB::WorkSpace.new(binding)\n" + f.print(code) + f.close - File.chmod(0, f.path) + File.chmod(0, f.path) - workspace = eval(code, binding, f.path) - assert_equal(nil, workspace.code_around_binding) + workspace = eval(code, binding, f.path) + assert_equal(nil, workspace.code_around_binding) + end end end -- cgit v1.2.3