diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-29 09:59:20 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-29 09:59:20 +0000 |
commit | defcaf89dd9ed860f8ac00508ff80bcde86645a1 (patch) | |
tree | bd8c034eccc3be6e7e3f836761e995ebd9203b72 /test/ruby | |
parent | 6839932a2d64ac930165114c14f2c9e3b24f0fef (diff) |
file.c: File.lutime
* file.c (utime_internal): add File.lutime. [Feature #4052]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 4c5540eb4c..6f2fbb1bd2 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -647,6 +647,36 @@ class TestFileExhaustive < Test::Unit::TestCase assert_equal(t + 2, File.mtime(zerofile)) end + def test_utime_symlinkfile + return unless symlinkfile + t = Time.local(2000) + stat = File.lstat(symlinkfile) + assert_equal(File.utime(t, t, symlinkfile), 1) + assert_equal(File.stat(regular_file).atime, t) + assert_equal(File.stat(regular_file).mtime, t) + assert_equal(File.lstat(symlinkfile).atime, stat.atime) + assert_equal(File.lstat(symlinkfile).mtime, stat.mtime) + end + + def test_lutime + return unless File.respond_to?(:lutime) + return unless symlinkfile + + r = File.stat(regular_file) + t = Time.local(2000) + File.lutime(t + 1, t + 2, symlinkfile) + rescue NotImplementedError => e + skip(e.message) + else + stat = File.stat(regular_file) + assert_equal(r.atime, stat.atime) + assert_equal(r.mtime, stat.mtime) + + stat = File.lstat(symlinkfile) + assert_equal(t + 1, stat.atime) + assert_equal(t + 2, stat.mtime) + end + def test_hardlink return unless hardlinkfile assert_equal("file", File.ftype(hardlinkfile)) |