From b32388d5f805dd56dfc760662894893b6b3bdb92 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 15 May 2012 14:54:15 +0000 Subject: [PATCH] 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 --- test/ruby/test_file.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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|