summaryrefslogtreecommitdiff
path: root/test/ruby/test_file.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-15 14:54:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-15 14:54:15 +0000
commitb32388d5f805dd56dfc760662894893b6b3bdb92 (patch)
treea310d2802022bbf33061b951a28e23c550a534aa /test/ruby/test_file.rb
parent0d9608eb3cc4d15c82692781cb608ce15c13c41d (diff)
test for Bug #6385
* test/ruby/test_file.rb (TestFile#test_utime): test for [Bug #6385]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_file.rb')
-rw-r--r--test/ruby/test_file.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index 2e5979f53f..54983d6deb 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -196,6 +196,26 @@ class TestFile < Test::Unit::TestCase
EOS
end
+ def test_utime
+ bug6385 = '[ruby-core:44776]'
+
+ mod_time_contents = Time.at 1306527039
+
+ file = Tempfile.new("utime")
+ file.close
+ path = file.path
+
+ File.utime(File.atime(path), mod_time_contents, path)
+ stats = File.stat(path)
+
+ file.open
+ file_mtime = file.mtime
+ file.close(true)
+
+ assert_equal(mod_time_contents, file_mtime, bug6385)
+ assert_equal(mod_time_contents, stats.mtime, bug6385)
+ end
+
def test_chmod_m17n
bug5671 = '[ruby-dev:44898]'
Dir.mktmpdir('test-file-chmod-m17n-') do |tmpdir|