Skip to content

Commit 27ff6be

Browse files
authored
Merge pull request jruby#9193 from eregon/update-specs
Update specs
2 parents 31c7f8f + ee9da53 commit 27ff6be

210 files changed

Lines changed: 3858 additions & 4123 deletions

File tree

Some content is hidden

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

spec/mspec/tool/sync/sync-rubyspec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,20 @@ def test_new_specs
190190
Dir.chdir(SOURCE_REPO) do
191191
workflow = YAML.load_file(".github/workflows/ci.yml")
192192
job_name = MSPEC ? "test" : "specs"
193-
versions = workflow.dig("jobs", job_name, "strategy", "matrix", "ruby")
193+
versions = workflow.dig("jobs", job_name, "strategy", "matrix", "ruby").map(&:to_s)
194194
versions = versions.grep(/^\d+\./) # Test on MRI
195195
min_version, max_version = versions.minmax
196196

197197
test_command = MSPEC ? "bundle install && bundle exec rspec" : "../mspec/bin/mspec -j"
198198

199199
run_test = -> version {
200-
command = "chruby #{version} && #{test_command}"
200+
command = "chruby ruby-#{version} && #{test_command}"
201201
sh ENV["SHELL"], "-c", command
202202
}
203203

204204
run_test[min_version]
205205
run_test[max_version]
206-
run_test["ruby-master"] if TEST_MASTER
206+
run_test["master"] if TEST_MASTER
207207
end
208208
end
209209

spec/ruby/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ For older specs try these commits:
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)
6666
* Ruby 3.1.6 - [Suite](https://github.com/ruby/spec/commit/ec960f2389d1c2265d32397fa8afa6d462014efc) using [MSpec](https://github.com/ruby/mspec/commit/484310dbed35b84c74484fd674602f88c42d063a)
67+
* Ruby 3.2.9 - [Suite](https://github.com/ruby/spec/commit/97f076242b7fc6e60703e6a6053365065cd6fc30) using [MSpec](https://github.com/ruby/mspec/commit/54704795e21128a930af2021c72c49cb87065134)
6768

6869
### Running the specs
6970

spec/ruby/command_line/dash_r_spec.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), options: "-r #{@test_file}", args: "2>&1", exit_status: 1)
1717
$?.should_not.success?
1818
out.should include("REQUIRED")
19-
20-
# it's tempting not to rely on error message and rely only on exception class name,
21-
# but CRuby before 3.2 doesn't print class name for syntax error
22-
out.should include_any_of("syntax error", "SyntaxError")
19+
out.should include("SyntaxError")
2320
end
2421

2522
it "does not require the file if the main script file does not exist" do

spec/ruby/command_line/syntax_error_spec.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@
33
describe "The interpreter" do
44
it "prints an error when given a file with invalid syntax" do
55
out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), args: "2>&1", exit_status: 1)
6-
7-
# it's tempting not to rely on error message and rely only on exception class name,
8-
# but CRuby before 3.2 doesn't print class name for syntax error
9-
out.should include_any_of("syntax error", "SyntaxError")
6+
out.should.include?("SyntaxError")
107
end
118

129
it "prints an error when given code via -e with invalid syntax" do
1310
out = ruby_exe(nil, args: "-e 'a{' 2>&1", exit_status: 1)
14-
15-
# it's tempting not to rely on error message and rely only on exception class name,
16-
# but CRuby before 3.2 doesn't print class name for syntax error
17-
out.should include_any_of("syntax error", "SyntaxError")
11+
out.should.include?("SyntaxError")
1812
end
1913
end

spec/ruby/core/array/fetch_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
end
1313

1414
it "raises an IndexError if there is no element at index" do
15-
-> { [1, 2, 3].fetch(3) }.should raise_error(IndexError)
16-
-> { [1, 2, 3].fetch(-4) }.should raise_error(IndexError)
17-
-> { [].fetch(0) }.should raise_error(IndexError)
15+
-> { [1, 2, 3].fetch(3) }.should raise_error(IndexError, "index 3 outside of array bounds: -3...3")
16+
-> { [1, 2, 3].fetch(-4) }.should raise_error(IndexError, "index -4 outside of array bounds: -3...3")
17+
-> { [].fetch(0) }.should raise_error(IndexError, "index 0 outside of array bounds: 0...0")
1818
end
1919

2020
it "returns default if there is no element at index if passed a default value" do
@@ -50,6 +50,6 @@ def o.to_int(); 5; end
5050
end
5151

5252
it "raises a TypeError when the passed argument can't be coerced to Integer" do
53-
-> { [].fetch("cat") }.should raise_error(TypeError)
53+
-> { [].fetch("cat") }.should raise_error(TypeError, "no implicit conversion of String into Integer")
5454
end
5555
end

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,10 @@
4545
[1, 2, 3, 4, 5].pack(pack_format('*')).should == "\x01\x02\x03\x04\x05"
4646
end
4747

48-
ruby_version_is ""..."3.3" do
49-
it "ignores NULL bytes between directives" do
50-
suppress_warning do
51-
[1, 2, 3].pack(pack_format("\000", 2)).should == "\x01\x02"
52-
end
53-
end
54-
end
55-
56-
ruby_version_is "3.3" do
57-
it "raise ArgumentError for NULL bytes between directives" do
58-
-> {
59-
[1, 2, 3].pack(pack_format("\000", 2))
60-
}.should raise_error(ArgumentError, /unknown pack directive/)
61-
end
48+
it "raise ArgumentError for NULL bytes between directives" do
49+
-> {
50+
[1, 2, 3].pack(pack_format("\000", 2))
51+
}.should raise_error(ArgumentError, /unknown pack directive/)
6252
end
6353

6454
it "ignores spaces between directives" do

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,11 @@
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.3" do
36-
it "warns that a directive is unknown" do
37-
# additional directive ('a') is required for the X directive
38-
-> { [@obj, @obj].pack("a K" + pack_format) }.should complain(/unknown pack directive 'K' in 'a K#{pack_format}'/)
39-
-> { [@obj, @obj].pack("a 0" + pack_format) }.should complain(/unknown pack directive '0' in 'a 0#{pack_format}'/)
40-
-> { [@obj, @obj].pack("a :" + pack_format) }.should complain(/unknown pack directive ':' in 'a :#{pack_format}'/)
41-
end
42-
end
43-
44-
ruby_version_is "3.3" do
45-
it "raise ArgumentError when a directive is unknown" do
46-
# additional directive ('a') is required for the X directive
47-
-> { [@obj, @obj].pack("a R" + pack_format) }.should raise_error(ArgumentError, /unknown pack directive 'R'/)
48-
-> { [@obj, @obj].pack("a 0" + pack_format) }.should raise_error(ArgumentError, /unknown pack directive '0'/)
49-
-> { [@obj, @obj].pack("a :" + pack_format) }.should raise_error(ArgumentError, /unknown pack directive ':'/)
50-
end
35+
it "raise ArgumentError when a directive is unknown" do
36+
# additional directive ('a') is required for the X directive
37+
-> { [@obj, @obj].pack("a R" + pack_format) }.should raise_error(ArgumentError, /unknown pack directive 'R'/)
38+
-> { [@obj, @obj].pack("a 0" + pack_format) }.should raise_error(ArgumentError, /unknown pack directive '0'/)
39+
-> { [@obj, @obj].pack("a :" + pack_format) }.should raise_error(ArgumentError, /unknown pack directive ':'/)
5140
end
5241

5342
it "calls #to_str to coerce the directives string" do

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

Lines changed: 16 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,10 @@
2525
[2.9, 1.4, 8.2].pack(pack_format("*")).should == "\x9a\x999@33\xb3?33\x03A"
2626
end
2727

28-
ruby_version_is ""..."3.3" do
29-
it "ignores NULL bytes between directives" do
30-
suppress_warning do
31-
[5.3, 9.2].pack(pack_format("\000", 2)).should == "\x9a\x99\xa9@33\x13A"
32-
end
33-
end
34-
end
35-
36-
ruby_version_is "3.3" do
37-
it "raise ArgumentError for NULL bytes between directives" do
38-
-> {
39-
[5.3, 9.2].pack(pack_format("\000", 2))
40-
}.should raise_error(ArgumentError, /unknown pack directive/)
41-
end
28+
it "raise ArgumentError for NULL bytes between directives" do
29+
-> {
30+
[5.3, 9.2].pack(pack_format("\000", 2))
31+
}.should raise_error(ArgumentError, /unknown pack directive/)
4232
end
4333

4434
it "ignores spaces between directives" do
@@ -105,20 +95,10 @@
10595
[2.9, 1.4, 8.2].pack(pack_format("*")).should == "@9\x99\x9a?\xb333A\x0333"
10696
end
10797

108-
ruby_version_is ""..."3.3" do
109-
it "ignores NULL bytes between directives" do
110-
suppress_warning do
111-
[5.3, 9.2].pack(pack_format("\000", 2)).should == "@\xa9\x99\x9aA\x1333"
112-
end
113-
end
114-
end
115-
116-
ruby_version_is "3.3" do
117-
it "raise ArgumentError for NULL bytes between directives" do
118-
-> {
119-
[5.3, 9.2].pack(pack_format("\000", 2))
120-
}.should raise_error(ArgumentError, /unknown pack directive/)
121-
end
98+
it "raise ArgumentError for NULL bytes between directives" do
99+
-> {
100+
[5.3, 9.2].pack(pack_format("\000", 2))
101+
}.should raise_error(ArgumentError, /unknown pack directive/)
122102
end
123103

124104
it "ignores spaces between directives" do
@@ -177,20 +157,10 @@
177157
[2.9, 1.4, 8.2].pack(pack_format("*")).should == "333333\x07@ffffff\xf6?ffffff\x20@"
178158
end
179159

180-
ruby_version_is ""..."3.3" do
181-
it "ignores NULL bytes between directives" do
182-
suppress_warning do
183-
[5.3, 9.2].pack(pack_format("\000", 2)).should == "333333\x15@ffffff\x22@"
184-
end
185-
end
186-
end
187-
188-
ruby_version_is "3.3" do
189-
it "raise ArgumentError for NULL bytes between directives" do
190-
-> {
191-
[5.3, 9.2].pack(pack_format("\000", 2))
192-
}.should raise_error(ArgumentError, /unknown pack directive/)
193-
end
160+
it "raise ArgumentError for NULL bytes between directives" do
161+
-> {
162+
[5.3, 9.2].pack(pack_format("\000", 2))
163+
}.should raise_error(ArgumentError, /unknown pack directive/)
194164
end
195165

196166
it "ignores spaces between directives" do
@@ -248,20 +218,10 @@
248218
[2.9, 1.4, 8.2].pack(pack_format("*")).should == "@\x07333333?\xf6ffffff@\x20ffffff"
249219
end
250220

251-
ruby_version_is ""..."3.3" do
252-
it "ignores NULL bytes between directives" do
253-
suppress_warning do
254-
[5.3, 9.2].pack(pack_format("\000", 2)).should == "@\x15333333@\x22ffffff"
255-
end
256-
end
257-
end
258-
259-
ruby_version_is "3.3" do
260-
it "raise ArgumentError for NULL bytes between directives" do
261-
-> {
262-
[5.3, 9.2].pack(pack_format("\000", 2))
263-
}.should raise_error(ArgumentError, /unknown pack directive/)
264-
end
221+
it "raise ArgumentError for NULL bytes between directives" do
222+
-> {
223+
[5.3, 9.2].pack(pack_format("\000", 2))
224+
}.should raise_error(ArgumentError, /unknown pack directive/)
265225
end
266226

267227
it "ignores spaces between directives" do

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

Lines changed: 24 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,10 @@
4141
str.should == "\x78\x65\xcd\xab\x21\x43"
4242
end
4343

44-
ruby_version_is ""..."3.3" do
45-
it "ignores NULL bytes between directives" do
46-
suppress_warning do
47-
str = [0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
48-
str.should == "\x78\x65\xcd\xab"
49-
end
50-
end
51-
end
52-
53-
ruby_version_is "3.3" do
54-
it "raise ArgumentError for NULL bytes between directives" do
55-
-> {
56-
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
57-
}.should raise_error(ArgumentError, /unknown pack directive/)
58-
end
44+
it "raise ArgumentError for NULL bytes between directives" do
45+
-> {
46+
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
47+
}.should raise_error(ArgumentError, /unknown pack directive/)
5948
end
6049

6150
it "ignores spaces between directives" do
@@ -105,21 +94,10 @@
10594
str.should == "\x65\x78\xab\xcd\x43\x21"
10695
end
10796

108-
ruby_version_is ""..."3.3" do
109-
it "ignores NULL bytes between directives" do
110-
suppress_warning do
111-
str = [0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
112-
str.should == "\x65\x78\xab\xcd"
113-
end
114-
end
115-
end
116-
117-
ruby_version_is "3.3" do
118-
it "raise ArgumentError for NULL bytes between directives" do
119-
-> {
120-
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
121-
}.should raise_error(ArgumentError, /unknown pack directive/)
122-
end
97+
it "raise ArgumentError for NULL bytes between directives" do
98+
-> {
99+
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
100+
}.should raise_error(ArgumentError, /unknown pack directive/)
123101
end
124102

125103
it "ignores spaces between directives" do
@@ -169,21 +147,10 @@
169147
str.should == "\x78\x65\x43\x12\xcd\xab\xf0\xde\x21\x43\x65\x78"
170148
end
171149

172-
ruby_version_is ""..."3.3" do
173-
it "ignores NULL bytes between directives" do
174-
suppress_warning do
175-
str = [0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
176-
str.should == "\x78\x65\x43\x12\xcd\xab\xf0\xde"
177-
end
178-
end
179-
end
180-
181-
ruby_version_is "3.3" do
182-
it "raise ArgumentError for NULL bytes between directives" do
183-
-> {
184-
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
185-
}.should raise_error(ArgumentError, /unknown pack directive/)
186-
end
150+
it "raise ArgumentError for NULL bytes between directives" do
151+
-> {
152+
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
153+
}.should raise_error(ArgumentError, /unknown pack directive/)
187154
end
188155

189156
it "ignores spaces between directives" do
@@ -233,21 +200,10 @@
233200
str.should == "\x12\x43\x65\x78\xde\xf0\xab\xcd\x78\x65\x43\x21"
234201
end
235202

236-
ruby_version_is ""..."3.3" do
237-
it "ignores NULL bytes between directives" do
238-
suppress_warning do
239-
str = [0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
240-
str.should == "\x12\x43\x65\x78\xde\xf0\xab\xcd"
241-
end
242-
end
243-
end
244-
245-
ruby_version_is "3.3" do
246-
it "raise ArgumentError for NULL bytes between directives" do
247-
-> {
248-
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
249-
}.should raise_error(ArgumentError, /unknown pack directive/)
250-
end
203+
it "raise ArgumentError for NULL bytes between directives" do
204+
-> {
205+
[0x1243_6578, 0xdef0_abcd].pack(pack_format("\000", 2))
206+
}.should raise_error(ArgumentError, /unknown pack directive/)
251207
end
252208

253209
it "ignores spaces between directives" do
@@ -357,21 +313,10 @@
357313
str.should == "\x56\x78\x12\x34\xcd\xab\xf0\xde\xf0\xde\xba\xdc\x21\x43\x65\x78"
358314
end
359315

360-
ruby_version_is ""..."3.3" do
361-
it "ignores NULL bytes between directives" do
362-
suppress_warning do
363-
str = [0xdef0_abcd_3412_7856, 0x7865_4321_dcba_def0].pack(pack_format("\000", 2))
364-
str.should == "\x56\x78\x12\x34\xcd\xab\xf0\xde\xf0\xde\xba\xdc\x21\x43\x65\x78"
365-
end
366-
end
367-
end
368-
369-
ruby_version_is "3.3" do
370-
it "raise ArgumentError for NULL bytes between directives" do
371-
-> {
372-
[0xdef0_abcd_3412_7856, 0x7865_4321_dcba_def0].pack(pack_format("\000", 2))
373-
}.should raise_error(ArgumentError, /unknown pack directive/)
374-
end
316+
it "raise ArgumentError for NULL bytes between directives" do
317+
-> {
318+
[0xdef0_abcd_3412_7856, 0x7865_4321_dcba_def0].pack(pack_format("\000", 2))
319+
}.should raise_error(ArgumentError, /unknown pack directive/)
375320
end
376321

377322
it "ignores spaces between directives" do
@@ -429,21 +374,10 @@
429374
str.should == "\xde\xf0\xab\xcd\x34\x12\x78\x56\x78\x65\x43\x21\xdc\xba\xde\xf0"
430375
end
431376

432-
ruby_version_is ""..."3.3" do
433-
it "ignores NULL bytes between directives" do
434-
suppress_warning do
435-
str = [0xdef0_abcd_3412_7856, 0x7865_4321_dcba_def0].pack(pack_format("\000", 2))
436-
str.should == "\xde\xf0\xab\xcd\x34\x12\x78\x56\x78\x65\x43\x21\xdc\xba\xde\xf0"
437-
end
438-
end
439-
end
440-
441-
ruby_version_is "3.3" do
442-
it "raise ArgumentError for NULL bytes between directives" do
443-
-> {
444-
[0xdef0_abcd_3412_7856, 0x7865_4321_dcba_def0].pack(pack_format("\000", 2))
445-
}.should raise_error(ArgumentError, /unknown pack directive/)
446-
end
377+
it "raise ArgumentError for NULL bytes between directives" do
378+
-> {
379+
[0xdef0_abcd_3412_7856, 0x7865_4321_dcba_def0].pack(pack_format("\000", 2))
380+
}.should raise_error(ArgumentError, /unknown pack directive/)
447381
end
448382

449383
it "ignores spaces between directives" do

0 commit comments

Comments
 (0)