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
15 15
    File.atime(@file).should be_kind_of(Time)
16 16
  end
17 17

  
18
  platform_is :linux do
18
  platform_is :linux, :windows do
19 19
    ## NOTE also that some Linux systems disable atime (e.g. via mount params) for better filesystem speed.
20 20
    it "returns the last access time for the named file with microseconds" do
21 21
      supports_subseconds = Integer(`stat -c%x '#{__FILE__}'`[/\.(\d+)/, 1], 10)
22
-- a/spec/rubyspec/core/file/ctime_spec.rb	Sat Jul 01 09:11:54 2017
22
++ b/spec/rubyspec/core/file/ctime_spec.rb	Sat Jul 01 09:13:49 2017
......
14 14
    File.ctime(@file).should be_kind_of(Time)
15 15
  end
16 16

  
17
  platform_is :linux do
17
  platform_is :linux, :windows do
18 18
    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
19 19
      supports_subseconds = Integer(`stat -c%z '#{__FILE__}'`[/\.(\d+)/, 1], 10)
20 20
      if supports_subseconds != 0
21
-- a/spec/rubyspec/core/file/mtime_spec.rb	Sat Jul 01 09:11:56 2017
21
++ b/spec/rubyspec/core/file/mtime_spec.rb	Sat Jul 01 09:13:36 2017
......
15 15
    File.mtime(@filename).should be_close(@mtime, 2.0)
16 16
  end
17 17

  
18
  platform_is :linux do
18
  platform_is :linux, :windows do
19 19
    it "returns the modification Time of the file with microseconds" do
20 20
      supports_subseconds = Integer(`stat -c%y '#{__FILE__}'`[/\.(\d+)/, 1], 10)
21 21
      if supports_subseconds != 0
22
-- a/spec/rubyspec/core/file/utime_spec.rb	Sat Jul 01 09:11:58 2017
22
++ b/spec/rubyspec/core/file/utime_spec.rb	Sat Jul 01 08:34:49 2017
......
16 16

  
17 17
  it "sets the access and modification time of each file" do
18 18
    File.utime(@atime, @mtime, @file1, @file2)
19
    File.atime(@file1).to_i.should be_close(@atime.to_i, 2)
20
    File.mtime(@file1).to_i.should be_close(@mtime.to_i, 2)
21
    File.atime(@file2).to_i.should be_close(@atime.to_i, 2)
22
    File.mtime(@file2).to_i.should be_close(@mtime.to_i, 2)
19
    File.atime(@file1).should be_close(@atime, 0.0001)
20
    File.mtime(@file1).should be_close(@mtime, 0.0001)
21
    File.atime(@file2).should be_close(@atime, 0.0001)
22
    File.mtime(@file2).should be_close(@mtime, 0.0001)
23 23
  end
24 24

  
25 25
  it "uses the current times if two nil values are passed" do
26 26
    File.utime(nil, nil, @file1, @file2)
27
    File.atime(@file1).to_i.should be_close(Time.now.to_i, 2)
28
    File.mtime(@file1).to_i.should be_close(Time.now.to_i, 2)
29
    File.atime(@file2).to_i.should be_close(Time.now.to_i, 2)
30
    File.mtime(@file2).to_i.should be_close(Time.now.to_i, 2)
27
    File.atime(@file1).should be_close(Time.now, 0.0001)
28
    File.mtime(@file1).should be_close(Time.now, 0.0001)
29
    File.atime(@file2).should be_close(Time.now, 0.0001)
30
    File.mtime(@file2).should be_close(Time.now, 0.0001)
31 31
  end
32 32

  
33

  
33 34
  it "accepts an object that has a #to_path method" do
34 35
    File.utime(@atime, @mtime, mock_to_path(@file1), mock_to_path(@file2))
35 36
  end
36 37
end
38