Skip to content

Commit

Permalink
Update to ruby/spec@30e1c35
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Jun 26, 2023
1 parent f73fa29 commit 515bd42
Show file tree
Hide file tree
Showing 428 changed files with 3,581 additions and 9,236 deletions.
2 changes: 1 addition & 1 deletion spec/ruby/.rubocop.yml
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0
DisplayCopNames: true
Exclude:
- command_line/fixtures/bad_syntax.rb
Expand Down
14 changes: 7 additions & 7 deletions spec/ruby/CONTRIBUTING.md
Expand Up @@ -138,12 +138,12 @@ Here is a list of the most commonly-used guards:
#### Version guards

```ruby
ruby_version_is ""..."2.6" do
# Specs for RUBY_VERSION < 2.6
ruby_version_is ""..."3.2" do
# Specs for RUBY_VERSION < 3.2
end

ruby_version_is "2.6" do
# Specs for RUBY_VERSION >= 2.6
ruby_version_is "3.2" do
# Specs for RUBY_VERSION >= 3.2
end
```

Expand Down Expand Up @@ -191,11 +191,11 @@ end
#### Combining guards

```ruby
guard -> { platform_is :windows and ruby_version_is ""..."2.6" } do
# Windows and RUBY_VERSION < 2.6
guard -> { platform_is :windows and ruby_version_is ""..."3.2" } do
# Windows and RUBY_VERSION < 3.2
end

guard_not -> { platform_is :windows and ruby_version_is ""..."2.6" } do
guard_not -> { platform_is :windows and ruby_version_is ""..."3.2" } do
# The opposite
end
```
Expand Down
5 changes: 3 additions & 2 deletions spec/ruby/README.md
Expand Up @@ -30,8 +30,8 @@ ruby/spec is known to be tested in these implementations for every commit:
* [Opal](https://github.com/opal/opal/tree/master/spec)
* [Artichoke](https://github.com/artichoke/spec/tree/artichoke-vendor)

ruby/spec describes the behavior of Ruby 2.7 and more recent Ruby versions.
More precisely, every latest stable MRI release should [pass](https://github.com/ruby/spec/actions/workflows/ci.yml) all specs of ruby/spec (2.7.x, 3.0.x, 3.1.x, etc), and those are tested in CI.
ruby/spec describes the behavior of Ruby 3.0 and more recent Ruby versions.
More precisely, every latest stable MRI release should [pass](https://github.com/ruby/spec/actions/workflows/ci.yml) all specs of ruby/spec (3.0.x, 3.1.x, 3.2.x, etc), and those are tested in CI.

### Synchronization with Ruby Implementations

Expand Down Expand Up @@ -61,6 +61,7 @@ For older specs try these commits:
* Ruby 2.4.10 - [Suite](https://github.com/ruby/spec/commit/bce4f2b81d6c31db67cf4d023a0625ceadde59bd) using [MSpec](https://github.com/ruby/mspec/commit/e7eb8aa4c26495b7b461e687d950b96eb08b3ff2)
* Ruby 2.5.9 - [Suite](https://github.com/ruby/spec/commit/c503335d3d9f6ec6ef24de60a0716c34af69b64f) using [MSpec](https://github.com/ruby/mspec/commit/0091e8a62e954717cd54641f935eaf1403692041)
* Ruby 2.6.10 - [Suite](https://github.com/ruby/spec/commit/aaf998fb8c92c4e63ad423a2e7ca6e6921818c6e) using [MSpec](https://github.com/ruby/mspec/commit/5e36c684e9e2b92b1187589bba1df22c640a8661)
* Ruby 2.7.8 - [Suite](https://github.com/ruby/spec/commit/93787e6035c925b593a9c0c6fb0e7e07a6f1df1f) using [MSpec](https://github.com/ruby/mspec/commit/1d8cf64722d8a7529f7cd205be5f16a89b7a67fd)

### Running the specs

Expand Down
44 changes: 21 additions & 23 deletions spec/ruby/command_line/backtrace_limit_spec.rb
@@ -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 spec/ruby/core/argf/bytes_spec.rb

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

12 changes: 2 additions & 10 deletions spec/ruby/core/array/drop_spec.rb
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 spec/ruby/core/array/drop_while_spec.rb
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 spec/ruby/core/array/flatten_spec.rb
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 spec/ruby/core/array/multiply_spec.rb
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

0 comments on commit 515bd42

Please sign in to comment.