mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Feature #21205] Fix up birthtime in ruby/spec
This commit is contained in:
parent
18a036a613
commit
8872d3e10b
Notes:
git
2025-05-30 13:00:32 +00:00
2 changed files with 26 additions and 47 deletions
|
@ -1,5 +1,6 @@
|
|||
require_relative '../../spec_helper'
|
||||
|
||||
platform_is :windows, :darwin, :freebsd, :netbsd, :linux do
|
||||
describe "File.birthtime" do
|
||||
before :each do
|
||||
@file = __FILE__
|
||||
|
@ -9,7 +10,6 @@ describe "File.birthtime" do
|
|||
@file = nil
|
||||
end
|
||||
|
||||
platform_is :windows, :darwin, :freebsd, :netbsd do
|
||||
it "returns the birth time for the named file as a Time object" do
|
||||
File.birthtime(@file)
|
||||
File.birthtime(@file).should be_kind_of(Time)
|
||||
|
@ -24,15 +24,6 @@ describe "File.birthtime" do
|
|||
end
|
||||
end
|
||||
|
||||
platform_is :openbsd do
|
||||
it "raises an NotImplementedError" do
|
||||
-> { File.birthtime(@file) }.should raise_error(NotImplementedError)
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: depends on Linux kernel version
|
||||
end
|
||||
|
||||
describe "File#birthtime" do
|
||||
before :each do
|
||||
@file = File.open(__FILE__)
|
||||
|
@ -43,18 +34,11 @@ describe "File#birthtime" do
|
|||
@file = nil
|
||||
end
|
||||
|
||||
platform_is :windows, :darwin, :freebsd, :netbsd do
|
||||
it "returns the birth time for self" do
|
||||
@file.birthtime
|
||||
@file.birthtime.should be_kind_of(Time)
|
||||
end
|
||||
end
|
||||
|
||||
platform_is :openbsd do
|
||||
it "raises an NotImplementedError" do
|
||||
-> { @file.birthtime }.should raise_error(NotImplementedError)
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: depends on Linux kernel version
|
||||
end
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
require_relative '../../../spec_helper'
|
||||
|
||||
platform_is(:windows, :darwin, :freebsd, :netbsd,
|
||||
*ruby_version_is("3.5") { :linux },
|
||||
) do
|
||||
describe "File::Stat#birthtime" do
|
||||
before :each do
|
||||
@file = tmp('i_exist')
|
||||
|
@ -10,18 +13,10 @@ describe "File::Stat#birthtime" do
|
|||
rm_r @file
|
||||
end
|
||||
|
||||
platform_is :windows, :darwin, :freebsd, :netbsd do
|
||||
it "returns the birthtime of a File::Stat object" do
|
||||
st = File.stat(@file)
|
||||
st.birthtime.should be_kind_of(Time)
|
||||
st.birthtime.should <= Time.now
|
||||
end
|
||||
end
|
||||
|
||||
platform_is :linux, :openbsd do
|
||||
it "raises an NotImplementedError" do
|
||||
st = File.stat(@file)
|
||||
-> { st.birthtime }.should raise_error(NotImplementedError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue