summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_file.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index f0a8d67a5d..f984a8fd23 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -252,6 +252,10 @@ class TestFile < Test::Unit::TestCase
tst = realdir + (File::SEPARATOR*3 + ".")
assert_equal(realdir, File.realpath(tst))
assert_equal(realdir, File.realpath(".", tst))
+ assert_equal(realdir, Dir.chdir(realdir) {File.realpath(".")})
+ realpath = File.join(realdir, "test")
+ File.write(realpath, "")
+ assert_equal(realpath, Dir.chdir(realdir) {File.realpath("test")})
if File::ALT_SEPARATOR
bug2961 = '[ruby-core:28653]'
assert_equal(realdir, File.realpath(realdir.tr(File::SEPARATOR, File::ALT_SEPARATOR)), bug2961)
@@ -318,6 +322,8 @@ class TestFile < Test::Unit::TestCase
assert_equal(realdir, File.realdirpath(tst))
assert_equal(realdir, File.realdirpath(".", tst))
assert_equal(File.join(realdir, "foo"), File.realdirpath("foo", tst))
+ assert_equal(realdir, Dir.chdir(realdir) {File.realdirpath(".")})
+ assert_equal(File.join(realdir, "foo"), Dir.chdir(realdir) {File.realdirpath("foo")})
}
begin
result = File.realdirpath("bar", "//:/foo")