ruby-changes:48785
From: k0kubun <ko1@a...>
Date: Fri, 24 Nov 2017 21:37:13 +0900 (JST)
Subject: [ruby-changes:48785] k0kubun:r60901 (trunk): test_workspace.rb: skip test failing on windows
k0kubun 2017-11-24 21:37:07 +0900 (Fri, 24 Nov 2017) New Revision: 60901 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60901 Log: 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. Modified files: trunk/test/irb/test_workspace.rb Index: test/irb/test_workspace.rb =================================================================== --- test/irb/test_workspace.rb (revision 60900) +++ test/irb/test_workspace.rb (revision 60901) @@ -32,16 +32,18 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_workspace.rb#L32 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/