summaryrefslogtreecommitdiff
path: root/test/pathname/test_pathname.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/pathname/test_pathname.rb')
-rw-r--r--test/pathname/test_pathname.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index dadcd1398c..43cef4849f 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -345,9 +345,26 @@ class TestPathname < Test::Unit::TestCase
def has_symlink?
begin
File.symlink("", "")
- rescue NotImplementedError, Errno::EACCES
+ rescue NotImplementedError
return false
rescue Errno::ENOENT
+ return false
+ rescue Errno::EACCES
+ return false
+ end
+ return true
+ end
+
+ def has_hardlink?
+ begin
+ with_tmpchdir("rubytest-pathname") {|dir|
+ File.write("dummy", "dummy")
+ File.link("dummy", "hardlink")
+ }
+ rescue NotImplementedError
+ return false
+ rescue Errno::EACCES
+ return false
end
return true
end
@@ -886,6 +903,7 @@ class TestPathname < Test::Unit::TestCase
end
def test_make_link
+ return if !has_hardlink?
with_tmpchdir('rubytest-pathname') {|dir|
open("a", "w") {|f| f.write "abc" }
Pathname("l").make_link(Pathname("a"))