Skip to content

Commit daf3d0a

Browse files
andrykonchineregon
authored andcommitted
[GR-14806] Update ruby/specs
PullRequest: truffleruby/4532
2 parents a8d4494 + d25c5e3 commit daf3d0a

File tree

401 files changed

+6309
-7351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

401 files changed

+6309
-7351
lines changed

ci.jsonnet

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ local part_definitions = {
324324
"CHECK_LEAKS": "true",
325325
"RUBY_SPEC_TEST_ZLIB_CRC_TABLE": "false", # CRuby was built on OL6 and is used on OL7
326326
},
327-
run+: jt(["-u", "ruby", "mspec", "spec/ruby"]) + # 3.2.2
328-
jt(["-u", "/cm/shared/apps-ol7/ruby/3.1.2/bin/ruby", "mspec", "spec/ruby"]),
327+
run+: jt(["-u", "ruby", "mspec", "spec/ruby"]), # 3.2.2
329328
},
330329

331330
test_fast: {

spec/ruby/.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
inherit_from: .rubocop_todo.yml
22

33
AllCops:
4-
TargetRubyVersion: 3.1
4+
TargetRubyVersion: 3.2
55
DisplayCopNames: true
66
Exclude:
77
- command_line/fixtures/bad_syntax.rb

spec/ruby/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ ruby/spec is known to be tested in these implementations for every commit:
3030
* [Opal](https://github.com/opal/opal/tree/master/spec)
3131
* [Artichoke](https://github.com/artichoke/spec/tree/artichoke-vendor)
3232

33-
ruby/spec describes the behavior of Ruby 3.1 and more recent Ruby versions.
34-
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.
33+
ruby/spec describes the behavior of Ruby 3.2 and more recent Ruby versions.
34+
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.
3535

3636
### Synchronization with Ruby Implementations
3737

@@ -63,6 +63,7 @@ For older specs try these commits:
6363
* Ruby 2.6.10 - [Suite](https://github.com/ruby/spec/commit/aaf998fb8c92c4e63ad423a2e7ca6e6921818c6e) using [MSpec](https://github.com/ruby/mspec/commit/5e36c684e9e2b92b1187589bba1df22c640a8661)
6464
* Ruby 2.7.8 - [Suite](https://github.com/ruby/spec/commit/93787e6035c925b593a9c0c6fb0e7e07a6f1df1f) using [MSpec](https://github.com/ruby/mspec/commit/1d8cf64722d8a7529f7cd205be5f16a89b7a67fd)
6565
* Ruby 3.0.7 - [Suite](https://github.com/ruby/spec/commit/affef93d9940f615e4836f64b011da211f570913) using [MSpec](https://github.com/ruby/mspec/commit/0aabb3e548eb5ea6cad0125f8f46cee34542b6b7)
66+
* Ruby 3.1.6 - [Suite](https://github.com/ruby/spec/commit/ec960f2389d1c2265d32397fa8afa6d462014efc) using [MSpec](https://github.com/ruby/mspec/commit/484310dbed35b84c74484fd674602f88c42d063a)
6667

6768
### Running the specs
6869

spec/ruby/command_line/dash_0_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require_relative '../spec_helper'
2+
3+
describe "The -0 command line option" do
4+
it "sets $/ and $-0" do
5+
ruby_exe("puts $/, $-0", options: "-072").should == ":\n:\n"
6+
end
7+
8+
ruby_version_is "3.5" do
9+
it "sets $/ and $-0 as a frozen string" do
10+
ruby_exe("puts $/.frozen?, $-0.frozen?", options: "-072").should == "true\ntrue\n"
11+
end
12+
end
13+
end

spec/ruby/core/array/pack/a_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
["abc"].pack("A*").should == "abc"
2828
end
2929

30-
it "padds the output with spaces when the count exceeds the size of the String" do
30+
it "pads the output with spaces when the count exceeds the size of the String" do
3131
["abc"].pack("A6").should == "abc "
3232
end
3333

@@ -55,7 +55,7 @@
5555
["abc"].pack("a*").should == "abc"
5656
end
5757

58-
it "padds the output with NULL bytes when the count exceeds the size of the String" do
58+
it "pads the output with NULL bytes when the count exceeds the size of the String" do
5959
["abc"].pack("a6").should == "abc\x00\x00\x00"
6060
end
6161

spec/ruby/core/array/pack/shared/basic.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,7 @@
3232
[@obj, @obj, @obj, @obj].pack("aa #{pack_format} # some comment \n#{pack_format}").should be_an_instance_of(String)
3333
end
3434

35-
ruby_version_is ""..."3.2" do
36-
it "warns in verbose mode that a directive is unknown" do
37-
# additional directive ('a') is required for the X directive
38-
-> { [@obj, @obj].pack("a R" + pack_format) }.should complain(/unknown pack directive 'R'/, verbose: true)
39-
-> { [@obj, @obj].pack("a 0" + pack_format) }.should complain(/unknown pack directive '0'/, verbose: true)
40-
-> { [@obj, @obj].pack("a :" + pack_format) }.should complain(/unknown pack directive ':'/, verbose: true)
41-
end
42-
end
43-
44-
ruby_version_is "3.2"..."3.3" do
35+
ruby_version_is ""..."3.3" do
4536
# https://bugs.ruby-lang.org/issues/19150
4637
# NOTE: it's just a plan of the Ruby core team
4738
it "warns that a directive is unknown" do

spec/ruby/core/array/pack/z_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
["abc"].pack("Z*").should == "abc\x00"
2727
end
2828

29-
it "padds the output with NULL bytes when the count exceeds the size of the String" do
29+
it "pads the output with NULL bytes when the count exceeds the size of the String" do
3030
["abc"].pack("Z6").should == "abc\x00\x00\x00"
3131
end
3232

spec/ruby/core/array/shared/slice.rb

Lines changed: 91 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -754,99 +754,97 @@ def to.to_int() -2 end
754754
a.send(@method, (...-9)).should == []
755755
end
756756

757-
ruby_version_is "3.2" do
758-
describe "can be sliced with Enumerator::ArithmeticSequence" do
759-
it "with infinite/inverted ranges and negative steps" do
760-
@array = [0, 1, 2, 3, 4, 5]
761-
@array.send(@method, (2..).step(-1)).should == [2, 1, 0]
762-
@array.send(@method, (2..).step(-2)).should == [2, 0]
763-
@array.send(@method, (2..).step(-3)).should == [2]
764-
@array.send(@method, (2..).step(-4)).should == [2]
765-
766-
@array.send(@method, (-3..).step(-1)).should == [3, 2, 1, 0]
767-
@array.send(@method, (-3..).step(-2)).should == [3, 1]
768-
@array.send(@method, (-3..).step(-3)).should == [3, 0]
769-
@array.send(@method, (-3..).step(-4)).should == [3]
770-
@array.send(@method, (-3..).step(-5)).should == [3]
771-
772-
@array.send(@method, (..0).step(-1)).should == [5, 4, 3, 2, 1, 0]
773-
@array.send(@method, (..0).step(-2)).should == [5, 3, 1]
774-
@array.send(@method, (..0).step(-3)).should == [5, 2]
775-
@array.send(@method, (..0).step(-4)).should == [5, 1]
776-
@array.send(@method, (..0).step(-5)).should == [5, 0]
777-
@array.send(@method, (..0).step(-6)).should == [5]
778-
@array.send(@method, (..0).step(-7)).should == [5]
779-
780-
@array.send(@method, (...0).step(-1)).should == [5, 4, 3, 2, 1]
781-
@array.send(@method, (...0).step(-2)).should == [5, 3, 1]
782-
@array.send(@method, (...0).step(-3)).should == [5, 2]
783-
@array.send(@method, (...0).step(-4)).should == [5, 1]
784-
@array.send(@method, (...0).step(-5)).should == [5]
785-
@array.send(@method, (...0).step(-6)).should == [5]
786-
787-
@array.send(@method, (...1).step(-1)).should == [5, 4, 3, 2]
788-
@array.send(@method, (...1).step(-2)).should == [5, 3]
789-
@array.send(@method, (...1).step(-3)).should == [5, 2]
790-
@array.send(@method, (...1).step(-4)).should == [5]
791-
@array.send(@method, (...1).step(-5)).should == [5]
792-
793-
@array.send(@method, (..-5).step(-1)).should == [5, 4, 3, 2, 1]
794-
@array.send(@method, (..-5).step(-2)).should == [5, 3, 1]
795-
@array.send(@method, (..-5).step(-3)).should == [5, 2]
796-
@array.send(@method, (..-5).step(-4)).should == [5, 1]
797-
@array.send(@method, (..-5).step(-5)).should == [5]
798-
@array.send(@method, (..-5).step(-6)).should == [5]
799-
800-
@array.send(@method, (...-5).step(-1)).should == [5, 4, 3, 2]
801-
@array.send(@method, (...-5).step(-2)).should == [5, 3]
802-
@array.send(@method, (...-5).step(-3)).should == [5, 2]
803-
@array.send(@method, (...-5).step(-4)).should == [5]
804-
@array.send(@method, (...-5).step(-5)).should == [5]
805-
806-
@array.send(@method, (4..1).step(-1)).should == [4, 3, 2, 1]
807-
@array.send(@method, (4..1).step(-2)).should == [4, 2]
808-
@array.send(@method, (4..1).step(-3)).should == [4, 1]
809-
@array.send(@method, (4..1).step(-4)).should == [4]
810-
@array.send(@method, (4..1).step(-5)).should == [4]
811-
812-
@array.send(@method, (4...1).step(-1)).should == [4, 3, 2]
813-
@array.send(@method, (4...1).step(-2)).should == [4, 2]
814-
@array.send(@method, (4...1).step(-3)).should == [4]
815-
@array.send(@method, (4...1).step(-4)).should == [4]
816-
817-
@array.send(@method, (-2..1).step(-1)).should == [4, 3, 2, 1]
818-
@array.send(@method, (-2..1).step(-2)).should == [4, 2]
819-
@array.send(@method, (-2..1).step(-3)).should == [4, 1]
820-
@array.send(@method, (-2..1).step(-4)).should == [4]
821-
@array.send(@method, (-2..1).step(-5)).should == [4]
822-
823-
@array.send(@method, (-2...1).step(-1)).should == [4, 3, 2]
824-
@array.send(@method, (-2...1).step(-2)).should == [4, 2]
825-
@array.send(@method, (-2...1).step(-3)).should == [4]
826-
@array.send(@method, (-2...1).step(-4)).should == [4]
827-
828-
@array.send(@method, (4..-5).step(-1)).should == [4, 3, 2, 1]
829-
@array.send(@method, (4..-5).step(-2)).should == [4, 2]
830-
@array.send(@method, (4..-5).step(-3)).should == [4, 1]
831-
@array.send(@method, (4..-5).step(-4)).should == [4]
832-
@array.send(@method, (4..-5).step(-5)).should == [4]
833-
834-
@array.send(@method, (4...-5).step(-1)).should == [4, 3, 2]
835-
@array.send(@method, (4...-5).step(-2)).should == [4, 2]
836-
@array.send(@method, (4...-5).step(-3)).should == [4]
837-
@array.send(@method, (4...-5).step(-4)).should == [4]
838-
839-
@array.send(@method, (-2..-5).step(-1)).should == [4, 3, 2, 1]
840-
@array.send(@method, (-2..-5).step(-2)).should == [4, 2]
841-
@array.send(@method, (-2..-5).step(-3)).should == [4, 1]
842-
@array.send(@method, (-2..-5).step(-4)).should == [4]
843-
@array.send(@method, (-2..-5).step(-5)).should == [4]
844-
845-
@array.send(@method, (-2...-5).step(-1)).should == [4, 3, 2]
846-
@array.send(@method, (-2...-5).step(-2)).should == [4, 2]
847-
@array.send(@method, (-2...-5).step(-3)).should == [4]
848-
@array.send(@method, (-2...-5).step(-4)).should == [4]
849-
end
757+
describe "can be sliced with Enumerator::ArithmeticSequence" do
758+
it "with infinite/inverted ranges and negative steps" do
759+
@array = [0, 1, 2, 3, 4, 5]
760+
@array.send(@method, (2..).step(-1)).should == [2, 1, 0]
761+
@array.send(@method, (2..).step(-2)).should == [2, 0]
762+
@array.send(@method, (2..).step(-3)).should == [2]
763+
@array.send(@method, (2..).step(-4)).should == [2]
764+
765+
@array.send(@method, (-3..).step(-1)).should == [3, 2, 1, 0]
766+
@array.send(@method, (-3..).step(-2)).should == [3, 1]
767+
@array.send(@method, (-3..).step(-3)).should == [3, 0]
768+
@array.send(@method, (-3..).step(-4)).should == [3]
769+
@array.send(@method, (-3..).step(-5)).should == [3]
770+
771+
@array.send(@method, (..0).step(-1)).should == [5, 4, 3, 2, 1, 0]
772+
@array.send(@method, (..0).step(-2)).should == [5, 3, 1]
773+
@array.send(@method, (..0).step(-3)).should == [5, 2]
774+
@array.send(@method, (..0).step(-4)).should == [5, 1]
775+
@array.send(@method, (..0).step(-5)).should == [5, 0]
776+
@array.send(@method, (..0).step(-6)).should == [5]
777+
@array.send(@method, (..0).step(-7)).should == [5]
778+
779+
@array.send(@method, (...0).step(-1)).should == [5, 4, 3, 2, 1]
780+
@array.send(@method, (...0).step(-2)).should == [5, 3, 1]
781+
@array.send(@method, (...0).step(-3)).should == [5, 2]
782+
@array.send(@method, (...0).step(-4)).should == [5, 1]
783+
@array.send(@method, (...0).step(-5)).should == [5]
784+
@array.send(@method, (...0).step(-6)).should == [5]
785+
786+
@array.send(@method, (...1).step(-1)).should == [5, 4, 3, 2]
787+
@array.send(@method, (...1).step(-2)).should == [5, 3]
788+
@array.send(@method, (...1).step(-3)).should == [5, 2]
789+
@array.send(@method, (...1).step(-4)).should == [5]
790+
@array.send(@method, (...1).step(-5)).should == [5]
791+
792+
@array.send(@method, (..-5).step(-1)).should == [5, 4, 3, 2, 1]
793+
@array.send(@method, (..-5).step(-2)).should == [5, 3, 1]
794+
@array.send(@method, (..-5).step(-3)).should == [5, 2]
795+
@array.send(@method, (..-5).step(-4)).should == [5, 1]
796+
@array.send(@method, (..-5).step(-5)).should == [5]
797+
@array.send(@method, (..-5).step(-6)).should == [5]
798+
799+
@array.send(@method, (...-5).step(-1)).should == [5, 4, 3, 2]
800+
@array.send(@method, (...-5).step(-2)).should == [5, 3]
801+
@array.send(@method, (...-5).step(-3)).should == [5, 2]
802+
@array.send(@method, (...-5).step(-4)).should == [5]
803+
@array.send(@method, (...-5).step(-5)).should == [5]
804+
805+
@array.send(@method, (4..1).step(-1)).should == [4, 3, 2, 1]
806+
@array.send(@method, (4..1).step(-2)).should == [4, 2]
807+
@array.send(@method, (4..1).step(-3)).should == [4, 1]
808+
@array.send(@method, (4..1).step(-4)).should == [4]
809+
@array.send(@method, (4..1).step(-5)).should == [4]
810+
811+
@array.send(@method, (4...1).step(-1)).should == [4, 3, 2]
812+
@array.send(@method, (4...1).step(-2)).should == [4, 2]
813+
@array.send(@method, (4...1).step(-3)).should == [4]
814+
@array.send(@method, (4...1).step(-4)).should == [4]
815+
816+
@array.send(@method, (-2..1).step(-1)).should == [4, 3, 2, 1]
817+
@array.send(@method, (-2..1).step(-2)).should == [4, 2]
818+
@array.send(@method, (-2..1).step(-3)).should == [4, 1]
819+
@array.send(@method, (-2..1).step(-4)).should == [4]
820+
@array.send(@method, (-2..1).step(-5)).should == [4]
821+
822+
@array.send(@method, (-2...1).step(-1)).should == [4, 3, 2]
823+
@array.send(@method, (-2...1).step(-2)).should == [4, 2]
824+
@array.send(@method, (-2...1).step(-3)).should == [4]
825+
@array.send(@method, (-2...1).step(-4)).should == [4]
826+
827+
@array.send(@method, (4..-5).step(-1)).should == [4, 3, 2, 1]
828+
@array.send(@method, (4..-5).step(-2)).should == [4, 2]
829+
@array.send(@method, (4..-5).step(-3)).should == [4, 1]
830+
@array.send(@method, (4..-5).step(-4)).should == [4]
831+
@array.send(@method, (4..-5).step(-5)).should == [4]
832+
833+
@array.send(@method, (4...-5).step(-1)).should == [4, 3, 2]
834+
@array.send(@method, (4...-5).step(-2)).should == [4, 2]
835+
@array.send(@method, (4...-5).step(-3)).should == [4]
836+
@array.send(@method, (4...-5).step(-4)).should == [4]
837+
838+
@array.send(@method, (-2..-5).step(-1)).should == [4, 3, 2, 1]
839+
@array.send(@method, (-2..-5).step(-2)).should == [4, 2]
840+
@array.send(@method, (-2..-5).step(-3)).should == [4, 1]
841+
@array.send(@method, (-2..-5).step(-4)).should == [4]
842+
@array.send(@method, (-2..-5).step(-5)).should == [4]
843+
844+
@array.send(@method, (-2...-5).step(-1)).should == [4, 3, 2]
845+
@array.send(@method, (-2...-5).step(-2)).should == [4, 2]
846+
@array.send(@method, (-2...-5).step(-3)).should == [4]
847+
@array.send(@method, (-2...-5).step(-4)).should == [4]
850848
end
851849
end
852850

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
require_relative '../../spec_helper'
22

3-
ruby_version_is '3.2' do
4-
describe "Class#attached_object" do
5-
it "returns the object that is attached to a singleton class" do
6-
a = Class.new
3+
describe "Class#attached_object" do
4+
it "returns the object that is attached to a singleton class" do
5+
a = Class.new
76

8-
a_obj = a.new
9-
a_obj.singleton_class.attached_object.should == a_obj
10-
end
7+
a_obj = a.new
8+
a_obj.singleton_class.attached_object.should == a_obj
9+
end
1110

12-
it "returns the class object that is attached to a class's singleton class" do
13-
a = Class.new
14-
singleton_class = (class << a; self; end)
11+
it "returns the class object that is attached to a class's singleton class" do
12+
a = Class.new
13+
singleton_class = (class << a; self; end)
1514

16-
singleton_class.attached_object.should == a
17-
end
15+
singleton_class.attached_object.should == a
16+
end
1817

19-
it "raises TypeError if the class is not a singleton class" do
20-
a = Class.new
18+
it "raises TypeError if the class is not a singleton class" do
19+
a = Class.new
2120

22-
-> { a.attached_object }.should raise_error(TypeError, /is not a singleton class/)
23-
end
21+
-> { a.attached_object }.should raise_error(TypeError, /is not a singleton class/)
22+
end
2423

25-
it "raises TypeError for special singleton classes" do
26-
-> { nil.singleton_class.attached_object }.should raise_error(TypeError, /[`']NilClass' is not a singleton class/)
27-
-> { true.singleton_class.attached_object }.should raise_error(TypeError, /[`']TrueClass' is not a singleton class/)
28-
-> { false.singleton_class.attached_object }.should raise_error(TypeError, /[`']FalseClass' is not a singleton class/)
29-
end
24+
it "raises TypeError for special singleton classes" do
25+
-> { nil.singleton_class.attached_object }.should raise_error(TypeError, /[`']NilClass' is not a singleton class/)
26+
-> { true.singleton_class.attached_object }.should raise_error(TypeError, /[`']TrueClass' is not a singleton class/)
27+
-> { false.singleton_class.attached_object }.should raise_error(TypeError, /[`']FalseClass' is not a singleton class/)
3028
end
3129
end

spec/ruby/core/class/fixtures/callback_order.rb

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)