mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refined "Drop support for ruby 2.4 from ruby/spec"
By using spec/mspec/tool/remove_old_guards.rb.
This commit is contained in:
parent
f49a24201c
commit
18f7d3c9a6
Notes:
git
2020-04-03 10:37:05 +09:00
9 changed files with 197 additions and 163 deletions
|
@ -3,7 +3,7 @@ require_relative '../../spec_helper'
|
|||
describe "File.utime" do
|
||||
|
||||
before :all do
|
||||
@time_is_float = /mswin|mingw/ =~ RUBY_PLATFORM && RUBY_VERSION >= '2.5'
|
||||
@time_is_float = /mswin|mingw/ =~ RUBY_PLATFORM
|
||||
end
|
||||
|
||||
before :each do
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
require_relative '../fixtures/classes'
|
||||
|
||||
describe :integer_arithmetic_coerce_rescue, shared: true do
|
||||
it "rescues exception (StandardError and subclasses) raised in other#coerce and raises TypeError" do
|
||||
b = mock("numeric with failed #coerce")
|
||||
b.should_receive(:coerce).and_raise(IntegerSpecs::CoerceError)
|
||||
|
||||
# e.g. 1 + b
|
||||
-> { 1.send(@method, b) }.should raise_error(TypeError, /MockObject can't be coerced into Integer/)
|
||||
end
|
||||
|
||||
it "does not rescue Exception and StandardError siblings raised in other#coerce" do
|
||||
[Exception, NoMemoryError].each do |exception|
|
||||
b = mock("numeric with failed #coerce")
|
||||
b.should_receive(:coerce).and_raise(exception)
|
||||
|
||||
# e.g. 1 + b
|
||||
-> { 1.send(@method, b) }.should raise_error(exception)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe :integer_arithmetic_coerce_not_rescue, shared: true do
|
||||
it "does not rescue exception raised in other#coerce" do
|
||||
b = mock("numeric with failed #coerce")
|
||||
|
|
|
@ -361,6 +361,22 @@ describe "The return keyword" do
|
|||
END_OF_CODE
|
||||
end
|
||||
|
||||
it "fires ensure block before returning while loads file" do
|
||||
File.write(@filename, <<-END_OF_CODE)
|
||||
ScratchPad << "before begin"
|
||||
begin
|
||||
return
|
||||
ensure
|
||||
ScratchPad << "within ensure"
|
||||
end
|
||||
|
||||
ScratchPad << "after begin"
|
||||
END_OF_CODE
|
||||
|
||||
load @filename
|
||||
ScratchPad.recorded.should == ["before begin", "within ensure"]
|
||||
end
|
||||
|
||||
it "swallows exception if returns in ensure block" do
|
||||
File.write(@filename, <<-END_OF_CODE)
|
||||
begin
|
||||
|
|
|
@ -106,7 +106,6 @@ describe "ConditionVariable#wait" do
|
|||
owned.should == true
|
||||
end
|
||||
|
||||
ruby_bug '#14999', ''...'2.5' do
|
||||
it "reacquires the lock even if the thread is killed after being signaled" do
|
||||
m = Mutex.new
|
||||
cv = ConditionVariable.new
|
||||
|
@ -141,7 +140,6 @@ describe "ConditionVariable#wait" do
|
|||
th.join
|
||||
owned.should == true
|
||||
end
|
||||
end
|
||||
|
||||
it "supports multiple Threads waiting on the same ConditionVariable and Mutex" do
|
||||
m = Mutex.new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue