Project

General

Profile

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

MSP-Greg (Greg L), 07/07/2017 02:25 AM

View differences:

spec/rubyspec/core/file/atime_spec.rb Sat Jul 01 09:11:52 2017 → spec/rubyspec/core/file/atime_spec.rb Sat Jul 01 09:14:00 2017
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)
-- a/spec/rubyspec/core/file/ctime_spec.rb Sat Jul 01 09:11:54 2017
++ b/spec/rubyspec/core/file/ctime_spec.rb Sat Jul 01 09:13:49 2017
......
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
-- a/spec/rubyspec/core/file/mtime_spec.rb Sat Jul 01 09:11:56 2017
++ b/spec/rubyspec/core/file/mtime_spec.rb Sat Jul 01 09:13:36 2017
......
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
-- a/spec/rubyspec/core/file/utime_spec.rb Sat Jul 01 09:11:58 2017
++ b/spec/rubyspec/core/file/utime_spec.rb Sat Jul 01 08:34:49 2017
......
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)
File.atime(@file1).should be_close(Time.now, 0.0001)
File.mtime(@file1).should be_close(Time.now, 0.0001)
File.atime(@file2).should be_close(Time.now, 0.0001)
File.mtime(@file2).should be_close(Time.now, 0.0001)
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
(2-2/4)