mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test: File.symlink needs administrator privilege
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
868c98dccf
commit
5dfc455b72
7 changed files with 18 additions and 14 deletions
|
@ -48,7 +48,7 @@ class TestFileUtils < Test::Unit::TestCase
|
|||
|
||||
def check_have_symlink?
|
||||
File.symlink nil, nil
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
return false
|
||||
rescue
|
||||
return true
|
||||
|
|
|
@ -340,7 +340,7 @@ class TestPathname < Test::Unit::TestCase
|
|||
def has_symlink?
|
||||
begin
|
||||
File.symlink(nil, nil)
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
return false
|
||||
rescue TypeError
|
||||
end
|
||||
|
|
|
@ -224,7 +224,7 @@ class TestDir < Test::Unit::TestCase
|
|||
File.symlink(File.join(@root, f),
|
||||
File.join(@root, "symlink-#{ f }"))
|
||||
end
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -303,7 +303,7 @@ class TestDir < Test::Unit::TestCase
|
|||
Dir.chdir(dirname) do
|
||||
begin
|
||||
File.symlink('some-dir', 'dir-symlink')
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
@symlinkfile = make_tmp_filename("symlinkfile")
|
||||
begin
|
||||
File.symlink(regular_file, @symlinkfile)
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
@symlinkfile = nil
|
||||
end
|
||||
@symlinkfile
|
||||
|
|
|
@ -403,7 +403,7 @@ class TestRequire < Test::Unit::TestCase
|
|||
File.symlink("../a/tst.rb", "b/tst.rb")
|
||||
result = IO.popen([EnvUtil.rubybin, "b/tst.rb"], &:read)
|
||||
assert_equal("a/lib.rb\n", result, "[ruby-dev:40040]")
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
skip "File.symlink is not implemented"
|
||||
end
|
||||
}
|
||||
|
|
|
@ -437,10 +437,14 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
}
|
||||
if File.respond_to? :symlink
|
||||
n2 = File.join(d, 't2')
|
||||
File.symlink(n1, n2)
|
||||
IO.popen([ruby, n2]) {|f|
|
||||
assert_equal(n2, f.read)
|
||||
}
|
||||
begin
|
||||
File.symlink(n1, n2)
|
||||
rescue Errno::EACCES
|
||||
else
|
||||
IO.popen([ruby, n2]) {|f|
|
||||
assert_equal(n2, f.read)
|
||||
}
|
||||
end
|
||||
end
|
||||
Dir.chdir(d) {
|
||||
n3 = '-e'
|
||||
|
|
|
@ -47,7 +47,7 @@ class TestFind < Test::Unit::TestCase
|
|||
File.open("#{d}/b/b", "w"){}
|
||||
begin
|
||||
File.symlink("#{d}/b", "#{d}/c")
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
skip "symlink is not supported."
|
||||
end
|
||||
a = []
|
||||
|
@ -168,7 +168,7 @@ class TestFind < Test::Unit::TestCase
|
|||
Dir.mktmpdir {|d|
|
||||
begin
|
||||
File.symlink("foo", "#{d}/bar")
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
skip "symlink is not supported."
|
||||
end
|
||||
a = []
|
||||
|
@ -182,7 +182,7 @@ class TestFind < Test::Unit::TestCase
|
|||
Dir.mktmpdir {|d|
|
||||
begin
|
||||
File.symlink("foo", "#{d}/bar")
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
skip "symlink is not supported."
|
||||
end
|
||||
assert_raise(Errno::ENOENT) {
|
||||
|
@ -228,7 +228,7 @@ class TestFind < Test::Unit::TestCase
|
|||
File.rename(dir_1, dir_2)
|
||||
begin
|
||||
File.symlink("d1", dir_1)
|
||||
rescue NotImplementedError
|
||||
rescue NotImplementedError, Errno::EACCES
|
||||
skip "symlink is not supported."
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue