Skip to content

Commit 122b088

Browse files
committed
Fix Pathname#lutime test and add the method back
1 parent abc9be5 commit 122b088

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

lib/pathname.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,13 @@ def truncate(length) File.truncate(@path, length) end
981981
# See <tt>File.utime</tt>. Update the access and modification times.
982982
def utime(atime, mtime) File.utime(atime, mtime, @path) end
983983

984+
# Update the access and modification times of the file.
985+
#
986+
# Same as Pathname#utime, but does not follow symbolic links.
987+
#
988+
# See File.lutime.
989+
def lutime(atime, mtime) File.lutime(atime, mtime, @path) end
990+
984991
# See <tt>File.basename</tt>. Returns the last component of the path.
985992
def basename(...) self.class.new(File.basename(@path, ...)) end
986993

test/pathname/test_pathname.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,11 @@ def test_lutime
10541054
latime = Time.utc(2000)
10551055
lmtime = Time.utc(1999)
10561056
File.symlink("a", "l")
1057-
Pathname("l").utime(latime, lmtime)
1057+
begin
1058+
Pathname("l").lutime(latime, lmtime)
1059+
rescue NotImplementedError
1060+
next
1061+
end
10581062
s = File.lstat("a")
10591063
ls = File.lstat("l")
10601064
assert_equal(atime, s.atime)

0 commit comments

Comments
 (0)