Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu, macos, windows ]
ruby: [ 3.1.6, 3.2.7, 3.3.7, 3.4.2 ]
ruby: [ 3.2.7, 3.3.7, 3.4.2 ]
rubyopt: [""]
include:
- os: ubuntu
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 3.1
TargetRubyVersion: 3.2
DisplayCopNames: true
Exclude:
- command_line/fixtures/bad_syntax.rb
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
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 3.1 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.1.x, 3.2.x, etc), and those are tested in CI.
ruby/spec describes the behavior of Ruby 3.2 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.2.x, 3.3.x, etc), and those are tested in CI.

### Synchronization with Ruby Implementations

Expand Down Expand Up @@ -63,6 +63,7 @@ For older specs try these commits:
* 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)
* Ruby 3.0.7 - [Suite](https://github.com/ruby/spec/commit/affef93d9940f615e4836f64b011da211f570913) using [MSpec](https://github.com/ruby/mspec/commit/0aabb3e548eb5ea6cad0125f8f46cee34542b6b7)
* Ruby 3.1.6 - [Suite](https://github.com/ruby/spec/commit/ec960f2389d1c2265d32397fa8afa6d462014efc) using [MSpec](https://github.com/ruby/mspec/commit/484310dbed35b84c74484fd674602f88c42d063a)

### Running the specs

Expand Down
11 changes: 1 addition & 10 deletions core/array/pack/shared/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,7 @@
[@obj, @obj, @obj, @obj].pack("aa #{pack_format} # some comment \n#{pack_format}").should be_an_instance_of(String)
end

ruby_version_is ""..."3.2" do
it "warns in verbose mode that a directive is unknown" do
# additional directive ('a') is required for the X directive
-> { [@obj, @obj].pack("a R" + pack_format) }.should complain(/unknown pack directive 'R'/, verbose: true)
-> { [@obj, @obj].pack("a 0" + pack_format) }.should complain(/unknown pack directive '0'/, verbose: true)
-> { [@obj, @obj].pack("a :" + pack_format) }.should complain(/unknown pack directive ':'/, verbose: true)
end
end

ruby_version_is "3.2"..."3.3" do
ruby_version_is ""..."3.3" do
# https://bugs.ruby-lang.org/issues/19150
# NOTE: it's just a plan of the Ruby core team
it "warns that a directive is unknown" do
Expand Down
184 changes: 91 additions & 93 deletions core/array/shared/slice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -754,99 +754,97 @@ def to.to_int() -2 end
a.send(@method, (...-9)).should == []
end

ruby_version_is "3.2" do
describe "can be sliced with Enumerator::ArithmeticSequence" do
it "with infinite/inverted ranges and negative steps" do
@array = [0, 1, 2, 3, 4, 5]
@array.send(@method, (2..).step(-1)).should == [2, 1, 0]
@array.send(@method, (2..).step(-2)).should == [2, 0]
@array.send(@method, (2..).step(-3)).should == [2]
@array.send(@method, (2..).step(-4)).should == [2]

@array.send(@method, (-3..).step(-1)).should == [3, 2, 1, 0]
@array.send(@method, (-3..).step(-2)).should == [3, 1]
@array.send(@method, (-3..).step(-3)).should == [3, 0]
@array.send(@method, (-3..).step(-4)).should == [3]
@array.send(@method, (-3..).step(-5)).should == [3]

@array.send(@method, (..0).step(-1)).should == [5, 4, 3, 2, 1, 0]
@array.send(@method, (..0).step(-2)).should == [5, 3, 1]
@array.send(@method, (..0).step(-3)).should == [5, 2]
@array.send(@method, (..0).step(-4)).should == [5, 1]
@array.send(@method, (..0).step(-5)).should == [5, 0]
@array.send(@method, (..0).step(-6)).should == [5]
@array.send(@method, (..0).step(-7)).should == [5]

@array.send(@method, (...0).step(-1)).should == [5, 4, 3, 2, 1]
@array.send(@method, (...0).step(-2)).should == [5, 3, 1]
@array.send(@method, (...0).step(-3)).should == [5, 2]
@array.send(@method, (...0).step(-4)).should == [5, 1]
@array.send(@method, (...0).step(-5)).should == [5]
@array.send(@method, (...0).step(-6)).should == [5]

@array.send(@method, (...1).step(-1)).should == [5, 4, 3, 2]
@array.send(@method, (...1).step(-2)).should == [5, 3]
@array.send(@method, (...1).step(-3)).should == [5, 2]
@array.send(@method, (...1).step(-4)).should == [5]
@array.send(@method, (...1).step(-5)).should == [5]

@array.send(@method, (..-5).step(-1)).should == [5, 4, 3, 2, 1]
@array.send(@method, (..-5).step(-2)).should == [5, 3, 1]
@array.send(@method, (..-5).step(-3)).should == [5, 2]
@array.send(@method, (..-5).step(-4)).should == [5, 1]
@array.send(@method, (..-5).step(-5)).should == [5]
@array.send(@method, (..-5).step(-6)).should == [5]

@array.send(@method, (...-5).step(-1)).should == [5, 4, 3, 2]
@array.send(@method, (...-5).step(-2)).should == [5, 3]
@array.send(@method, (...-5).step(-3)).should == [5, 2]
@array.send(@method, (...-5).step(-4)).should == [5]
@array.send(@method, (...-5).step(-5)).should == [5]

@array.send(@method, (4..1).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (4..1).step(-2)).should == [4, 2]
@array.send(@method, (4..1).step(-3)).should == [4, 1]
@array.send(@method, (4..1).step(-4)).should == [4]
@array.send(@method, (4..1).step(-5)).should == [4]

@array.send(@method, (4...1).step(-1)).should == [4, 3, 2]
@array.send(@method, (4...1).step(-2)).should == [4, 2]
@array.send(@method, (4...1).step(-3)).should == [4]
@array.send(@method, (4...1).step(-4)).should == [4]

@array.send(@method, (-2..1).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (-2..1).step(-2)).should == [4, 2]
@array.send(@method, (-2..1).step(-3)).should == [4, 1]
@array.send(@method, (-2..1).step(-4)).should == [4]
@array.send(@method, (-2..1).step(-5)).should == [4]

@array.send(@method, (-2...1).step(-1)).should == [4, 3, 2]
@array.send(@method, (-2...1).step(-2)).should == [4, 2]
@array.send(@method, (-2...1).step(-3)).should == [4]
@array.send(@method, (-2...1).step(-4)).should == [4]

@array.send(@method, (4..-5).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (4..-5).step(-2)).should == [4, 2]
@array.send(@method, (4..-5).step(-3)).should == [4, 1]
@array.send(@method, (4..-5).step(-4)).should == [4]
@array.send(@method, (4..-5).step(-5)).should == [4]

@array.send(@method, (4...-5).step(-1)).should == [4, 3, 2]
@array.send(@method, (4...-5).step(-2)).should == [4, 2]
@array.send(@method, (4...-5).step(-3)).should == [4]
@array.send(@method, (4...-5).step(-4)).should == [4]

@array.send(@method, (-2..-5).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (-2..-5).step(-2)).should == [4, 2]
@array.send(@method, (-2..-5).step(-3)).should == [4, 1]
@array.send(@method, (-2..-5).step(-4)).should == [4]
@array.send(@method, (-2..-5).step(-5)).should == [4]

@array.send(@method, (-2...-5).step(-1)).should == [4, 3, 2]
@array.send(@method, (-2...-5).step(-2)).should == [4, 2]
@array.send(@method, (-2...-5).step(-3)).should == [4]
@array.send(@method, (-2...-5).step(-4)).should == [4]
end
describe "can be sliced with Enumerator::ArithmeticSequence" do
it "with infinite/inverted ranges and negative steps" do
@array = [0, 1, 2, 3, 4, 5]
@array.send(@method, (2..).step(-1)).should == [2, 1, 0]
@array.send(@method, (2..).step(-2)).should == [2, 0]
@array.send(@method, (2..).step(-3)).should == [2]
@array.send(@method, (2..).step(-4)).should == [2]

@array.send(@method, (-3..).step(-1)).should == [3, 2, 1, 0]
@array.send(@method, (-3..).step(-2)).should == [3, 1]
@array.send(@method, (-3..).step(-3)).should == [3, 0]
@array.send(@method, (-3..).step(-4)).should == [3]
@array.send(@method, (-3..).step(-5)).should == [3]

@array.send(@method, (..0).step(-1)).should == [5, 4, 3, 2, 1, 0]
@array.send(@method, (..0).step(-2)).should == [5, 3, 1]
@array.send(@method, (..0).step(-3)).should == [5, 2]
@array.send(@method, (..0).step(-4)).should == [5, 1]
@array.send(@method, (..0).step(-5)).should == [5, 0]
@array.send(@method, (..0).step(-6)).should == [5]
@array.send(@method, (..0).step(-7)).should == [5]

@array.send(@method, (...0).step(-1)).should == [5, 4, 3, 2, 1]
@array.send(@method, (...0).step(-2)).should == [5, 3, 1]
@array.send(@method, (...0).step(-3)).should == [5, 2]
@array.send(@method, (...0).step(-4)).should == [5, 1]
@array.send(@method, (...0).step(-5)).should == [5]
@array.send(@method, (...0).step(-6)).should == [5]

@array.send(@method, (...1).step(-1)).should == [5, 4, 3, 2]
@array.send(@method, (...1).step(-2)).should == [5, 3]
@array.send(@method, (...1).step(-3)).should == [5, 2]
@array.send(@method, (...1).step(-4)).should == [5]
@array.send(@method, (...1).step(-5)).should == [5]

@array.send(@method, (..-5).step(-1)).should == [5, 4, 3, 2, 1]
@array.send(@method, (..-5).step(-2)).should == [5, 3, 1]
@array.send(@method, (..-5).step(-3)).should == [5, 2]
@array.send(@method, (..-5).step(-4)).should == [5, 1]
@array.send(@method, (..-5).step(-5)).should == [5]
@array.send(@method, (..-5).step(-6)).should == [5]

@array.send(@method, (...-5).step(-1)).should == [5, 4, 3, 2]
@array.send(@method, (...-5).step(-2)).should == [5, 3]
@array.send(@method, (...-5).step(-3)).should == [5, 2]
@array.send(@method, (...-5).step(-4)).should == [5]
@array.send(@method, (...-5).step(-5)).should == [5]

@array.send(@method, (4..1).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (4..1).step(-2)).should == [4, 2]
@array.send(@method, (4..1).step(-3)).should == [4, 1]
@array.send(@method, (4..1).step(-4)).should == [4]
@array.send(@method, (4..1).step(-5)).should == [4]

@array.send(@method, (4...1).step(-1)).should == [4, 3, 2]
@array.send(@method, (4...1).step(-2)).should == [4, 2]
@array.send(@method, (4...1).step(-3)).should == [4]
@array.send(@method, (4...1).step(-4)).should == [4]

@array.send(@method, (-2..1).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (-2..1).step(-2)).should == [4, 2]
@array.send(@method, (-2..1).step(-3)).should == [4, 1]
@array.send(@method, (-2..1).step(-4)).should == [4]
@array.send(@method, (-2..1).step(-5)).should == [4]

@array.send(@method, (-2...1).step(-1)).should == [4, 3, 2]
@array.send(@method, (-2...1).step(-2)).should == [4, 2]
@array.send(@method, (-2...1).step(-3)).should == [4]
@array.send(@method, (-2...1).step(-4)).should == [4]

@array.send(@method, (4..-5).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (4..-5).step(-2)).should == [4, 2]
@array.send(@method, (4..-5).step(-3)).should == [4, 1]
@array.send(@method, (4..-5).step(-4)).should == [4]
@array.send(@method, (4..-5).step(-5)).should == [4]

@array.send(@method, (4...-5).step(-1)).should == [4, 3, 2]
@array.send(@method, (4...-5).step(-2)).should == [4, 2]
@array.send(@method, (4...-5).step(-3)).should == [4]
@array.send(@method, (4...-5).step(-4)).should == [4]

@array.send(@method, (-2..-5).step(-1)).should == [4, 3, 2, 1]
@array.send(@method, (-2..-5).step(-2)).should == [4, 2]
@array.send(@method, (-2..-5).step(-3)).should == [4, 1]
@array.send(@method, (-2..-5).step(-4)).should == [4]
@array.send(@method, (-2..-5).step(-5)).should == [4]

@array.send(@method, (-2...-5).step(-1)).should == [4, 3, 2]
@array.send(@method, (-2...-5).step(-2)).should == [4, 2]
@array.send(@method, (-2...-5).step(-3)).should == [4]
@array.send(@method, (-2...-5).step(-4)).should == [4]
end
end

Expand Down
40 changes: 19 additions & 21 deletions core/class/attached_object_spec.rb
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
require_relative '../../spec_helper'

ruby_version_is '3.2' do
describe "Class#attached_object" do
it "returns the object that is attached to a singleton class" do
a = Class.new
describe "Class#attached_object" do
it "returns the object that is attached to a singleton class" do
a = Class.new

a_obj = a.new
a_obj.singleton_class.attached_object.should == a_obj
end
a_obj = a.new
a_obj.singleton_class.attached_object.should == a_obj
end

it "returns the class object that is attached to a class's singleton class" do
a = Class.new
singleton_class = (class << a; self; end)
it "returns the class object that is attached to a class's singleton class" do
a = Class.new
singleton_class = (class << a; self; end)

singleton_class.attached_object.should == a
end
singleton_class.attached_object.should == a
end

it "raises TypeError if the class is not a singleton class" do
a = Class.new
it "raises TypeError if the class is not a singleton class" do
a = Class.new

-> { a.attached_object }.should raise_error(TypeError, /is not a singleton class/)
end
-> { a.attached_object }.should raise_error(TypeError, /is not a singleton class/)
end

it "raises TypeError for special singleton classes" do
-> { nil.singleton_class.attached_object }.should raise_error(TypeError, /[`']NilClass' is not a singleton class/)
-> { true.singleton_class.attached_object }.should raise_error(TypeError, /[`']TrueClass' is not a singleton class/)
-> { false.singleton_class.attached_object }.should raise_error(TypeError, /[`']FalseClass' is not a singleton class/)
end
it "raises TypeError for special singleton classes" do
-> { nil.singleton_class.attached_object }.should raise_error(TypeError, /[`']NilClass' is not a singleton class/)
-> { true.singleton_class.attached_object }.should raise_error(TypeError, /[`']TrueClass' is not a singleton class/)
-> { false.singleton_class.attached_object }.should raise_error(TypeError, /[`']FalseClass' is not a singleton class/)
end
end
24 changes: 11 additions & 13 deletions core/complex/polar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@
->{ Complex.polar(nil, nil) }.should raise_error(TypeError)
end

ruby_bug "#19004", ""..."3.2" do
it "computes the real values of the real & imaginary parts from the polar form" do
a = Complex.polar(1.0+0.0i, Math::PI/2+0.0i)
a.real.should be_close(0.0, TOLERANCE)
a.imag.should be_close(1.0, TOLERANCE)
a.real.real?.should be_true
a.imag.real?.should be_true
it "computes the real values of the real & imaginary parts from the polar form" do
a = Complex.polar(1.0+0.0i, Math::PI/2+0.0i)
a.real.should be_close(0.0, TOLERANCE)
a.imag.should be_close(1.0, TOLERANCE)
a.real.real?.should be_true
a.imag.real?.should be_true

b = Complex.polar(1+0.0i)
b.real.should be_close(1.0, TOLERANCE)
b.imag.should be_close(0.0, TOLERANCE)
b.real.real?.should be_true
b.imag.real?.should be_true
end
b = Complex.polar(1+0.0i)
b.real.should be_close(1.0, TOLERANCE)
b.imag.should be_close(0.0, TOLERANCE)
b.real.real?.should be_true
b.imag.real?.should be_true
end
end

Expand Down
20 changes: 5 additions & 15 deletions core/data/constants_spec.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
require_relative '../../spec_helper'

ruby_version_is ''...'3.2' do
describe "Data" do
it "does not exist anymore" do
Object.should_not have_constant(:Data)
end
describe "Data" do
it "is a new constant" do
Data.superclass.should == Object
end
end

ruby_version_is '3.2' do
describe "Data" do
it "is a new constant" do
Data.superclass.should == Object
end

it "is not deprecated" do
-> { Data }.should_not complain
end
it "is not deprecated" do
-> { Data }.should_not complain
end
end
Loading