diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-02-08 19:43:27 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-04-01 15:36:20 +0900 |
commit | 826f44834fe11f3f9c52343443a15b6c83466889 (patch) | |
tree | f2c2abed62db1c750515cd8b0fbac6442b6d4200 /spec/ruby/core/thread | |
parent | 3a2073e61b6ccce6d07d31ebd89d4c385b9a55f2 (diff) | |
download | ruby-826f44834fe11f3f9c52343443a15b6c83466889.tar.gz |
Drop support for ruby 2.4 from ruby/spec
Diffstat (limited to 'spec/ruby/core/thread')
-rw-r--r-- | spec/ruby/core/thread/fetch_spec.rb | 54 | ||||
-rw-r--r-- | spec/ruby/core/thread/report_on_exception_spec.rb | 24 | ||||
-rw-r--r-- | spec/ruby/core/thread/to_s_spec.rb | 6 |
3 files changed, 35 insertions, 49 deletions
diff --git a/spec/ruby/core/thread/fetch_spec.rb b/spec/ruby/core/thread/fetch_spec.rb index d71c938880..6b37d4cfc5 100644 --- a/spec/ruby/core/thread/fetch_spec.rb +++ b/spec/ruby/core/thread/fetch_spec.rb @@ -1,38 +1,36 @@ require_relative '../../spec_helper' -ruby_version_is '2.5' do - describe 'Thread#fetch' do - describe 'with 2 arguments' do - it 'returns the value of the fiber-local variable if value has been assigned' do - th = Thread.new { Thread.current[:cat] = 'meow' } - th.join - th.fetch(:cat, true).should == 'meow' - end - - it "returns the default value if fiber-local variable hasn't been assigned" do - th = Thread.new {} - th.join - th.fetch(:cat, true).should == true - end +describe 'Thread#fetch' do + describe 'with 2 arguments' do + it 'returns the value of the fiber-local variable if value has been assigned' do + th = Thread.new { Thread.current[:cat] = 'meow' } + th.join + th.fetch(:cat, true).should == 'meow' end - describe 'with 1 argument' do - it 'raises a KeyError when the Thread does not have a fiber-local variable of the same name' do - th = Thread.new {} - th.join - -> { th.fetch(:cat) }.should raise_error(KeyError) - end + it "returns the default value if fiber-local variable hasn't been assigned" do + th = Thread.new {} + th.join + th.fetch(:cat, true).should == true + end + end - it 'returns the value of the fiber-local variable if value has been assigned' do - th = Thread.new { Thread.current[:cat] = 'meow' } - th.join - th.fetch(:cat).should == 'meow' - end + describe 'with 1 argument' do + it 'raises a KeyError when the Thread does not have a fiber-local variable of the same name' do + th = Thread.new {} + th.join + -> { th.fetch(:cat) }.should raise_error(KeyError) end - it 'raises an ArgumentError when not passed one or two arguments' do - -> { Thread.current.fetch() }.should raise_error(ArgumentError) - -> { Thread.current.fetch(1, 2, 3) }.should raise_error(ArgumentError) + it 'returns the value of the fiber-local variable if value has been assigned' do + th = Thread.new { Thread.current[:cat] = 'meow' } + th.join + th.fetch(:cat).should == 'meow' end end + + it 'raises an ArgumentError when not passed one or two arguments' do + -> { Thread.current.fetch() }.should raise_error(ArgumentError) + -> { Thread.current.fetch(1, 2, 3) }.should raise_error(ArgumentError) + end end diff --git a/spec/ruby/core/thread/report_on_exception_spec.rb b/spec/ruby/core/thread/report_on_exception_spec.rb index a6042ba759..bf50a167df 100644 --- a/spec/ruby/core/thread/report_on_exception_spec.rb +++ b/spec/ruby/core/thread/report_on_exception_spec.rb @@ -1,16 +1,8 @@ require_relative '../../spec_helper' describe "Thread.report_on_exception" do - ruby_version_is "2.4"..."2.5" do - it "defaults to false" do - ruby_exe("p Thread.report_on_exception").should == "false\n" - end - end - - ruby_version_is "2.5" do - it "defaults to true" do - ruby_exe("p Thread.report_on_exception").should == "true\n" - end + it "defaults to true" do + ruby_exe("p Thread.report_on_exception").should == "true\n" end end @@ -33,14 +25,12 @@ describe "Thread.report_on_exception=" do end describe "Thread#report_on_exception" do - ruby_version_is "2.5" do - it "returns true for the main Thread" do - Thread.current.report_on_exception.should == true - end + it "returns true for the main Thread" do + Thread.current.report_on_exception.should == true + end - it "returns true for new Threads" do - Thread.new { Thread.current.report_on_exception }.value.should == true - end + it "returns true for new Threads" do + Thread.new { Thread.current.report_on_exception }.value.should == true end it "returns whether the Thread will print a backtrace if it exits with an exception" do diff --git a/spec/ruby/core/thread/to_s_spec.rb b/spec/ruby/core/thread/to_s_spec.rb index 85976177dc..cb182a017f 100644 --- a/spec/ruby/core/thread/to_s_spec.rb +++ b/spec/ruby/core/thread/to_s_spec.rb @@ -1,8 +1,6 @@ require_relative '../../spec_helper' require_relative 'shared/to_s' -ruby_version_is "2.5" do - describe "Thread#to_s" do - it_behaves_like :thread_to_s, :to_s - end +describe "Thread#to_s" do + it_behaves_like :thread_to_s, :to_s end |