From a852853f447710072f8dbea8de4960ecfe5bfd0d Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 15 May 2017 07:35:26 +0000 Subject: Should call `ln_s` only when symlink is available * test/fileutils/test_fileutils.rb (test_ln_s): skip if symlink is not available. * test/fileutils/test_fileutils.rb (test_ln_s): remove created symlink certainly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/fileutils/test_fileutils.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index 16257e6091..923468d2b9 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -785,12 +785,14 @@ class TestFileUtils < Test::Unit::TestCase TARGETS.each do |fname| fname = "../#{fname}" - ln_s fname, 'tmp/lnsdest' - assert FileTest.symlink?('tmp/lnsdest'), 'not symlink' - assert_equal fname, File.readlink('tmp/lnsdest') - rm_f 'tmp/lnsdest' + lnfname = 'tmp/lnsdest' + ln_s fname, lnfname + assert FileTest.symlink?(lnfname), 'not symlink' + assert_equal fname, File.readlink(lnfname) + ensure + rm_f lnfname end - end + end if have_symlink? and !no_broken_symlink? def test_ln_s_broken_symlink assert_nothing_raised { -- cgit v1.2.3