Project

General

Profile

Feature #13726 » spec-rubyspec-core-file-time.patch

Updated utime - MSP-Greg (Greg L), 07/11/2017 02:42 PM

View differences:

spec/rubyspec/core/file/atime_spec.rb
File.atime(@file).should be_kind_of(Time)
end
platform_is :linux do
platform_is :linux, :windows do
## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed.
it "returns the last access time for the named file with microseconds" do
supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10)
spec/rubyspec/core/file/ctime_spec.rb
File.ctime(@file).should be_kind_of(Time)
end
platform_is :linux do
platform_is :linux, :windows do
it "returns the change time for the named file (the time at which directory information about the file was changed, not the file itself) with microseconds." do
supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d+)/, 1], 10)
if supports_subseconds != 0
spec/rubyspec/core/file/mtime_spec.rb
File.mtime(@filename).should be_close(@mtime, 2.0)
end
platform_is :linux do
platform_is :linux, :windows do
it "returns the modification Time of the file with microseconds" do
supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d+)/, 1], 10)
if supports_subseconds != 0
spec/rubyspec/core/file/utime_spec.rb
it "sets the access and modification time of each file" do
File.utime(@atime, @mtime, @file1, @file2)
File.atime(@file1).to_i.should be_close(@atime.to_i, 2)
File.mtime(@file1).to_i.should be_close(@mtime.to_i, 2)
File.atime(@file2).to_i.should be_close(@atime.to_i, 2)
File.mtime(@file2).to_i.should be_close(@mtime.to_i, 2)
File.atime(@file1).should be_close(@atime, 0.0001)
File.mtime(@file1).should be_close(@mtime, 0.0001)
File.atime(@file2).should be_close(@atime, 0.0001)
File.mtime(@file2).should be_close(@mtime, 0.0001)
end
it "uses the current times if two nil values are passed" do
File.utime(nil, nil, @file1, @file2)
File.atime(@file1).to_i.should be_close(Time.now.to_i, 2)
File.mtime(@file1).to_i.should be_close(Time.now.to_i, 2)
File.atime(@file2).to_i.should be_close(Time.now.to_i, 2)
File.mtime(@file2).to_i.should be_close(Time.now.to_i, 2)
tn = Time.now
File.atime(@file1).should be_close(tn, 0.0002)
File.mtime(@file1).should be_close(tn, 0.0002)
File.atime(@file2).should be_close(tn, 0.0002)
File.mtime(@file2).should be_close(tn, 0.0002)
end
it "accepts an object that has a #to_path method" do
File.utime(@atime, @mtime, mock_to_path(@file1), mock_to_path(@file2))
end
end
(4-4/4)