summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@idaemons.org>2022-04-04 02:03:09 +0900
committergit <svn-admin@ruby-lang.org>2022-04-21 17:10:19 +0900
commitcb02324c4e5c7aae0add0a5c4e5adbf637d9acb0 (patch)
tree74c62daf0ff30dee952ed2ca5c950a1efd61375e /test
parent3ddf6ad4d2f6dae4caa00b8c407768c7062099a0 (diff)
[ruby/pathname] Implement Pathname#lutime
https://github.com/ruby/pathname/commit/268cb5acff
Diffstat (limited to 'test')
-rw-r--r--test/pathname/test_pathname.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index c971597602..a23dc21ae3 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -1043,6 +1043,25 @@ class TestPathname < Test::Unit::TestCase
}
end
+ def test_lutime
+ return if !has_symlink?
+ with_tmpchdir('rubytest-pathname') {|dir|
+ open("a", "w") {|f| f.write "abc" }
+ atime = File.atime("a")
+ mtime = File.mtime("a")
+ latime = Time.utc(2000)
+ lmtime = Time.utc(1999)
+ File.symlink("a", "l")
+ Pathname("l").utime(latime, lmtime)
+ s = File.lstat("a")
+ ls = File.lstat("l")
+ assert_equal(atime, s.atime)
+ assert_equal(mtime, s.mtime)
+ assert_equal(latime, ls.atime)
+ assert_equal(lmtime, ls.mtime)
+ }
+ end
+
def test_basename
assert_equal(Pathname("basename"), Pathname("dirname/basename").basename)
assert_equal(Pathname("bar"), Pathname("foo/bar.x").basename(".x"))