Skip to content

Commit 97686ef

Browse files
committed
1 parent e2f4a6f commit 97686ef

File tree

161 files changed

+2672
-3278
lines changed

Some content is hidden

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

161 files changed

+2672
-3278
lines changed

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: 2.5
4+
TargetRubyVersion: 2.6
55
DisplayCopNames: true
66
Exclude:
77
- command_line/fixtures/bad_syntax.rb

spec/ruby/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ First, file a bug at https://bugs.ruby-lang.org/.
178178
It is better to use a `ruby_version_is` guard if there was a release with the fix.
179179

180180
```ruby
181-
ruby_bug '#13669', ''...'2.5' do
181+
ruby_bug '#13669', ''...'2.7' do
182182
it "works like this" do
183183
# Specify the expected behavior here, not the bug
184184
end

spec/ruby/README.md

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

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

3535
### Synchronization with Ruby Implementations
3636

@@ -57,6 +57,7 @@ For older specs try these commits:
5757
* Ruby 2.2.10 - [Suite](https://github.com/ruby/spec/commit/cbaa0e412270c944df0c2532fc500c920dba0e92) using [MSpec](https://github.com/ruby/mspec/commit/d84d7668449e96856c5f6bac8cb1526b6d357ce3)
5858
* Ruby 2.3.8 - [Suite](https://github.com/ruby/spec/commit/dc733114d8ae66a3368ba3a98422c50147a76ba5) using [MSpec](https://github.com/ruby/mspec/commit/4599bc195fb109f2a482a01c32a7d659518369ea)
5959
* Ruby 2.4.10 - [Suite](https://github.com/ruby/spec/commit/bce4f2b81d6c31db67cf4d023a0625ceadde59bd) using [MSpec](https://github.com/ruby/mspec/commit/e7eb8aa4c26495b7b461e687d950b96eb08b3ff2)
60+
* Ruby 2.5.9 - [Suite](https://github.com/ruby/spec/commit/c503335d3d9f6ec6ef24de60a0716c34af69b64f) using [MSpec](https://github.com/ruby/mspec/commit/0091e8a62e954717cd54641f935eaf1403692041)
6061

6162
### Running the specs
6263

spec/ruby/command_line/dash_upper_w_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
end
3838

3939
ruby_version_is "3.0" do
40-
@src = '[0, 1] => [a, b]'
40+
@src = 'warn "This is experimental warning.", category: :experimental'
4141
end
4242
end
4343

spec/ruby/command_line/feature_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Since some specs disable reading RUBYOPT, we instead pass its contents as :options for those specs
66
rubyopt = [ENV["RUBYOPT"]]
77
rubyopt << ENV["#{RUBY_ENGINE.upcase}OPT"] unless RUBY_ENGINE == 'ruby'
8-
@rubyopt = rubyopt.compact.join(" ")
8+
@rubyopt = RUBY_ENGINE == "ruby" ? "" : rubyopt.compact.join(" ")
99
end
1010

1111
it "can be used with gems" do

spec/ruby/core/array/difference_spec.rb

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22
require_relative 'fixtures/classes'
33
require_relative 'shared/difference'
44

5-
ruby_version_is "2.6" do
6-
describe "Array#difference" do
7-
it_behaves_like :array_binary_difference, :difference
5+
describe "Array#difference" do
6+
it_behaves_like :array_binary_difference, :difference
87

9-
it "returns a copy when called without any parameter" do
10-
x = [1, 2, 3, 2]
11-
x.difference.should == x
12-
x.difference.should_not equal x
13-
end
8+
it "returns a copy when called without any parameter" do
9+
x = [1, 2, 3, 2]
10+
x.difference.should == x
11+
x.difference.should_not equal x
12+
end
1413

15-
it "does not return subclass instances for Array subclasses" do
16-
ArraySpecs::MyArray[1, 2, 3].difference.should be_an_instance_of(Array)
17-
end
14+
it "does not return subclass instances for Array subclasses" do
15+
ArraySpecs::MyArray[1, 2, 3].difference.should be_an_instance_of(Array)
16+
end
1817

19-
it "accepts multiple arguments" do
20-
x = [1, 2, 3, 1]
21-
x.difference([], [0, 1], [3, 4], [3]).should == [2]
22-
end
18+
it "accepts multiple arguments" do
19+
x = [1, 2, 3, 1]
20+
x.difference([], [0, 1], [3, 4], [3]).should == [2]
2321
end
2422
end

spec/ruby/core/array/element_set_spec.rb

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -445,41 +445,39 @@ def obj.to_ary() [1, 2, 3] end
445445
end
446446
end
447447

448-
ruby_version_is "2.6" do
449-
describe "Array#[]= with [m..]" do
450-
it "just sets the section defined by range to nil even if the rhs is nil" do
451-
a = [1, 2, 3, 4, 5]
452-
a[eval("(2..)")] = nil
453-
a.should == [1, 2, nil]
454-
end
448+
describe "Array#[]= with [m..]" do
449+
it "just sets the section defined by range to nil even if the rhs is nil" do
450+
a = [1, 2, 3, 4, 5]
451+
a[eval("(2..)")] = nil
452+
a.should == [1, 2, nil]
453+
end
455454

456-
it "just sets the section defined by range to nil if m and n < 0 and the rhs is nil" do
457-
a = [1, 2, 3, 4, 5]
458-
a[eval("(-3..)")] = nil
459-
a.should == [1, 2, nil]
460-
end
455+
it "just sets the section defined by range to nil if m and n < 0 and the rhs is nil" do
456+
a = [1, 2, 3, 4, 5]
457+
a[eval("(-3..)")] = nil
458+
a.should == [1, 2, nil]
459+
end
461460

462-
it "replaces the section defined by range" do
463-
a = [6, 5, 4, 3, 2, 1]
464-
a[eval("(3...)")] = 9
465-
a.should == [6, 5, 4, 9]
466-
a[eval("(2..)")] = [7, 7, 7]
467-
a.should == [6, 5, 7, 7, 7]
468-
end
461+
it "replaces the section defined by range" do
462+
a = [6, 5, 4, 3, 2, 1]
463+
a[eval("(3...)")] = 9
464+
a.should == [6, 5, 4, 9]
465+
a[eval("(2..)")] = [7, 7, 7]
466+
a.should == [6, 5, 7, 7, 7]
467+
end
469468

470-
it "replaces the section if m and n < 0" do
471-
a = [1, 2, 3, 4, 5]
472-
a[eval("(-3..)")] = [7, 8, 9]
473-
a.should == [1, 2, 7, 8, 9]
474-
end
469+
it "replaces the section if m and n < 0" do
470+
a = [1, 2, 3, 4, 5]
471+
a[eval("(-3..)")] = [7, 8, 9]
472+
a.should == [1, 2, 7, 8, 9]
473+
end
475474

476-
it "inserts at the end if m > the array size" do
477-
a = [1, 2, 3]
478-
a[eval("(3..)")] = [4]
479-
a.should == [1, 2, 3, 4]
480-
a[eval("(5..)")] = [6]
481-
a.should == [1, 2, 3, 4, nil, 6]
482-
end
475+
it "inserts at the end if m > the array size" do
476+
a = [1, 2, 3]
477+
a[eval("(3..)")] = [4]
478+
a.should == [1, 2, 3, 4]
479+
a[eval("(5..)")] = [6]
480+
a.should == [1, 2, 3, 4, nil, 6]
483481
end
484482
end
485483

spec/ruby/core/array/fill_spec.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,11 @@ def obj.<=>(rhs); rhs == self ? 0 : nil end
316316
-> { [].fill('a', obj..obj) }.should raise_error(TypeError)
317317
end
318318

319-
ruby_version_is "2.6" do
320-
it "works with endless ranges" do
321-
[1, 2, 3, 4].fill('x', eval("(1..)")).should == [1, 'x', 'x', 'x']
322-
[1, 2, 3, 4].fill('x', eval("(3...)")).should == [1, 2, 3, 'x']
323-
[1, 2, 3, 4].fill(eval("(1..)")) { |x| x + 2 }.should == [1, 3, 4, 5]
324-
[1, 2, 3, 4].fill(eval("(3...)")) { |x| x + 2 }.should == [1, 2, 3, 5]
325-
end
319+
it "works with endless ranges" do
320+
[1, 2, 3, 4].fill('x', eval("(1..)")).should == [1, 'x', 'x', 'x']
321+
[1, 2, 3, 4].fill('x', eval("(3...)")).should == [1, 2, 3, 'x']
322+
[1, 2, 3, 4].fill(eval("(1..)")) { |x| x + 2 }.should == [1, 3, 4, 5]
323+
[1, 2, 3, 4].fill(eval("(3...)")) { |x| x + 2 }.should == [1, 2, 3, 5]
326324
end
327325

328326
ruby_version_is "2.7" do

spec/ruby/core/array/filter_spec.rb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
require_relative '../../spec_helper'
22
require_relative 'shared/select'
33

4-
ruby_version_is "2.6" do
5-
describe "Array#filter" do
6-
it_behaves_like :array_select, :filter
7-
end
8-
9-
describe "Array#filter!" do
10-
it "returns nil if no changes were made in the array" do
11-
[1, 2, 3].filter! { true }.should be_nil
12-
end
4+
describe "Array#filter" do
5+
it_behaves_like :array_select, :filter
6+
end
137

14-
it_behaves_like :keep_if, :filter!
8+
describe "Array#filter!" do
9+
it "returns nil if no changes were made in the array" do
10+
[1, 2, 3].filter! { true }.should be_nil
1511
end
12+
13+
it_behaves_like :keep_if, :filter!
1614
end

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -521,18 +521,16 @@ def to.to_int() -2 end
521521
-> { "hello".send(@method, 0..bignum_value) }.should raise_error(RangeError)
522522
end
523523

524-
ruby_version_is "2.6" do
525-
it "can accept endless ranges" do
526-
a = [0, 1, 2, 3, 4, 5]
527-
a.send(@method, eval("(2..)")).should == [2, 3, 4, 5]
528-
a.send(@method, eval("(2...)")).should == [2, 3, 4, 5]
529-
a.send(@method, eval("(-2..)")).should == [4, 5]
530-
a.send(@method, eval("(-2...)")).should == [4, 5]
531-
a.send(@method, eval("(9..)")).should == nil
532-
a.send(@method, eval("(9...)")).should == nil
533-
a.send(@method, eval("(-9..)")).should == nil
534-
a.send(@method, eval("(-9...)")).should == nil
535-
end
524+
it "can accept endless ranges" do
525+
a = [0, 1, 2, 3, 4, 5]
526+
a.send(@method, eval("(2..)")).should == [2, 3, 4, 5]
527+
a.send(@method, eval("(2...)")).should == [2, 3, 4, 5]
528+
a.send(@method, eval("(-2..)")).should == [4, 5]
529+
a.send(@method, eval("(-2...)")).should == [4, 5]
530+
a.send(@method, eval("(9..)")).should == nil
531+
a.send(@method, eval("(9...)")).should == nil
532+
a.send(@method, eval("(-9..)")).should == nil
533+
a.send(@method, eval("(-9...)")).should == nil
536534
end
537535

538536
ruby_version_is "2.7" do

0 commit comments

Comments
 (0)