Skip to content

Commit

Permalink
Remove version guards for 3.0 since it is now the minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed May 31, 2023
1 parent 77b630c commit f0525c9
Show file tree
Hide file tree
Showing 352 changed files with 2,304 additions and 8,679 deletions.
44 changes: 21 additions & 23 deletions command_line/backtrace_limit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
require_relative '../spec_helper'

ruby_version_is "3.0" do
describe "The --backtrace-limit command line option" do
it "limits top-level backtraces to a given number of entries" do
file = fixture(__FILE__ , "backtrace.rb")
out = ruby_exe(file, options: "--backtrace-limit=2", args: "top 2>&1", exit_status: 1)
out = out.gsub(__dir__, '')
describe "The --backtrace-limit command line option" do
it "limits top-level backtraces to a given number of entries" do
file = fixture(__FILE__ , "backtrace.rb")
out = ruby_exe(file, options: "--backtrace-limit=2", args: "top 2>&1", exit_status: 1)
out = out.gsub(__dir__, '')

out.should == <<-MSG
out.should == <<-MSG
top
/fixtures/backtrace.rb:2:in `a': oops (RuntimeError)
\tfrom /fixtures/backtrace.rb:6:in `b'
\tfrom /fixtures/backtrace.rb:10:in `c'
\t ... 2 levels...
MSG
end
MSG
end

it "affects Exception#full_message" do
file = fixture(__FILE__ , "backtrace.rb")
out = ruby_exe(file, options: "--backtrace-limit=2", args: "full_message 2>&1")
out = out.gsub(__dir__, '')
it "affects Exception#full_message" do
file = fixture(__FILE__ , "backtrace.rb")
out = ruby_exe(file, options: "--backtrace-limit=2", args: "full_message 2>&1")
out = out.gsub(__dir__, '')

out.should == <<-MSG
out.should == <<-MSG
full_message
/fixtures/backtrace.rb:2:in `a': oops (RuntimeError)
\tfrom /fixtures/backtrace.rb:6:in `b'
\tfrom /fixtures/backtrace.rb:10:in `c'
\t ... 2 levels...
MSG
end
MSG
end

it "does not affect Exception#backtrace" do
file = fixture(__FILE__ , "backtrace.rb")
out = ruby_exe(file, options: "--backtrace-limit=2", args: "backtrace 2>&1")
out = out.gsub(__dir__, '')
it "does not affect Exception#backtrace" do
file = fixture(__FILE__ , "backtrace.rb")
out = ruby_exe(file, options: "--backtrace-limit=2", args: "backtrace 2>&1")
out = out.gsub(__dir__, '')

out.should == <<-MSG
out.should == <<-MSG
backtrace
/fixtures/backtrace.rb:2:in `a'
/fixtures/backtrace.rb:6:in `b'
/fixtures/backtrace.rb:10:in `c'
/fixtures/backtrace.rb:14:in `d'
/fixtures/backtrace.rb:29:in `<main>'
MSG
end
MSG
end
end
16 changes: 0 additions & 16 deletions core/argf/bytes_spec.rb

This file was deleted.

16 changes: 0 additions & 16 deletions core/argf/chars_spec.rb

This file was deleted.

16 changes: 0 additions & 16 deletions core/argf/codepoints_spec.rb

This file was deleted.

16 changes: 0 additions & 16 deletions core/argf/lines_spec.rb

This file was deleted.

12 changes: 2 additions & 10 deletions core/array/drop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,7 @@
-> { [1, 2].drop(obj) }.should raise_error(TypeError)
end

ruby_version_is ''...'3.0' do
it 'returns a subclass instance for Array subclasses' do
ArraySpecs::MyArray[1, 2, 3, 4, 5].drop(1).should be_an_instance_of(ArraySpecs::MyArray)
end
end

ruby_version_is '3.0' do
it 'returns a Array instance for Array subclasses' do
ArraySpecs::MyArray[1, 2, 3, 4, 5].drop(1).should be_an_instance_of(Array)
end
it 'returns a Array instance for Array subclasses' do
ArraySpecs::MyArray[1, 2, 3, 4, 5].drop(1).should be_an_instance_of(Array)
end
end
12 changes: 2 additions & 10 deletions core/array/drop_while_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,7 @@
[1, 2, 3, false, 5].drop_while { |n| n }.should == [false, 5]
end

ruby_version_is ''...'3.0' do
it 'returns a subclass instance for Array subclasses' do
ArraySpecs::MyArray[1, 2, 3, 4, 5].drop_while { |n| n < 4 }.should be_an_instance_of(ArraySpecs::MyArray)
end
end

ruby_version_is '3.0' do
it 'returns a Array instance for Array subclasses' do
ArraySpecs::MyArray[1, 2, 3, 4, 5].drop_while { |n| n < 4 }.should be_an_instance_of(Array)
end
it 'returns a Array instance for Array subclasses' do
ArraySpecs::MyArray[1, 2, 3, 4, 5].drop_while { |n| n < 4 }.should be_an_instance_of(Array)
end
end
24 changes: 6 additions & 18 deletions core/array/flatten_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,12 @@
[[obj]].flatten(1)
end

ruby_version_is ''...'3.0' do
it "returns subclass instance for Array subclasses" do
ArraySpecs::MyArray[].flatten.should be_an_instance_of(ArraySpecs::MyArray)
ArraySpecs::MyArray[1, 2, 3].flatten.should be_an_instance_of(ArraySpecs::MyArray)
ArraySpecs::MyArray[1, [2], 3].flatten.should be_an_instance_of(ArraySpecs::MyArray)
ArraySpecs::MyArray[1, [2, 3], 4].flatten.should == ArraySpecs::MyArray[1, 2, 3, 4]
[ArraySpecs::MyArray[1, 2, 3]].flatten.should be_an_instance_of(Array)
end
end

ruby_version_is '3.0' do
it "returns Array instance for Array subclasses" do
ArraySpecs::MyArray[].flatten.should be_an_instance_of(Array)
ArraySpecs::MyArray[1, 2, 3].flatten.should be_an_instance_of(Array)
ArraySpecs::MyArray[1, [2], 3].flatten.should be_an_instance_of(Array)
ArraySpecs::MyArray[1, [2, 3], 4].flatten.should == [1, 2, 3, 4]
[ArraySpecs::MyArray[1, 2, 3]].flatten.should be_an_instance_of(Array)
end
it "returns Array instance for Array subclasses" do
ArraySpecs::MyArray[].flatten.should be_an_instance_of(Array)
ArraySpecs::MyArray[1, 2, 3].flatten.should be_an_instance_of(Array)
ArraySpecs::MyArray[1, [2], 3].flatten.should be_an_instance_of(Array)
ArraySpecs::MyArray[1, [2, 3], 4].flatten.should == [1, 2, 3, 4]
[ArraySpecs::MyArray[1, 2, 3]].flatten.should be_an_instance_of(Array)
end

it "is not destructive" do
Expand Down
18 changes: 4 additions & 14 deletions core/array/multiply_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,10 @@ def obj.to_str() "2" end
@array = ArraySpecs::MyArray[1, 2, 3, 4, 5]
end

ruby_version_is ''...'3.0' do
it "returns a subclass instance" do
(@array * 0).should be_an_instance_of(ArraySpecs::MyArray)
(@array * 1).should be_an_instance_of(ArraySpecs::MyArray)
(@array * 2).should be_an_instance_of(ArraySpecs::MyArray)
end
end

ruby_version_is '3.0' do
it "returns an Array instance" do
(@array * 0).should be_an_instance_of(Array)
(@array * 1).should be_an_instance_of(Array)
(@array * 2).should be_an_instance_of(Array)
end
it "returns an Array instance" do
(@array * 0).should be_an_instance_of(Array)
(@array * 1).should be_an_instance_of(Array)
(@array * 2).should be_an_instance_of(Array)
end

it "does not call #initialize on the subclass instance" do
Expand Down
Loading

0 comments on commit f0525c9

Please sign in to comment.