Skip to content

Commit 45cf4f2

Browse files
committed
1 parent 6ae81d4 commit 45cf4f2

File tree

277 files changed

+3579
-7359
lines changed

Some content is hidden

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

277 files changed

+3579
-7359
lines changed

spec/ruby/.rubocop.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
inherit_from: .rubocop_todo.yml
22

33
AllCops:
4-
TargetRubyVersion: 2.6
4+
TargetRubyVersion: 2.7
55
DisplayCopNames: true
66
Exclude:
77
- command_line/fixtures/bad_syntax.rb
88
DisabledByDefault: true
9+
NewCops: disable
910

1011
Layout/TrailingWhitespace:
1112
Enabled: true
@@ -56,12 +57,52 @@ Lint/UnusedMethodArgument:
5657
Lint/UselessAssignment:
5758
Enabled: false
5859

59-
Lint/UselessComparison:
60+
Lint/BinaryOperatorWithIdenticalOperands:
6061
Enabled: false
6162

63+
Lint/EmptyConditionalBody:
64+
Enabled: false # buggy
65+
6266
Lint/Void:
6367
Enabled: false
6468

69+
Lint/ConstantDefinitionInBlock:
70+
Enabled: false
71+
72+
Lint/RaiseException:
73+
Enabled: false
74+
75+
Lint/FloatComparison:
76+
Enabled: false
77+
78+
Lint/DeprecatedClassMethods:
79+
Enabled: false
80+
81+
Lint/UnreachableLoop:
82+
Enabled: false
83+
84+
Lint/MissingSuper:
85+
Enabled: false
86+
87+
Lint/UselessMethodDefinition:
88+
Enabled: false
89+
90+
Lint/UselessTimes:
91+
Enabled: false
92+
93+
Lint/MixedRegexpCaptureTypes:
94+
Enabled: false
95+
96+
Lint/DuplicateElsifCondition:
97+
Enabled: false
98+
99+
Lint/OutOfRangeRegexpRef:
100+
Enabled: false
101+
102+
Lint/ElseLayout:
103+
Exclude:
104+
- 'language/if_spec.rb'
105+
65106
Lint/EmptyExpression:
66107
Exclude:
67108
- 'language/**/*.rb'

spec/ruby/CONTRIBUTING.md

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

182182
```ruby
183-
ruby_bug '#13669', ''...'2.7' do
183+
ruby_bug '#13669', ''...'3.2' do
184184
it "works like this" do
185185
# Specify the expected behavior here, not the bug
186186
end

spec/ruby/README.md

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

34-
ruby/spec describes the behavior of Ruby 2.6 and more recent Ruby versions.
35-
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.
34+
ruby/spec describes the behavior of Ruby 2.7 and more recent Ruby versions.
35+
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.
3636

3737
### Synchronization with Ruby Implementations
3838

@@ -61,6 +61,7 @@ For older specs try these commits:
6161
* Ruby 2.3.8 - [Suite](https://github.com/ruby/spec/commit/dc733114d8ae66a3368ba3a98422c50147a76ba5) using [MSpec](https://github.com/ruby/mspec/commit/4599bc195fb109f2a482a01c32a7d659518369ea)
6262
* Ruby 2.4.10 - [Suite](https://github.com/ruby/spec/commit/bce4f2b81d6c31db67cf4d023a0625ceadde59bd) using [MSpec](https://github.com/ruby/mspec/commit/e7eb8aa4c26495b7b461e687d950b96eb08b3ff2)
6363
* Ruby 2.5.9 - [Suite](https://github.com/ruby/spec/commit/c503335d3d9f6ec6ef24de60a0716c34af69b64f) using [MSpec](https://github.com/ruby/mspec/commit/0091e8a62e954717cd54641f935eaf1403692041)
64+
* Ruby 2.6.10 - [Suite](https://github.com/ruby/spec/commit/aaf998fb8c92c4e63ad423a2e7ca6e6921818c6e) using [MSpec](https://github.com/ruby/mspec/commit/5e36c684e9e2b92b1187589bba1df22c640a8661)
6465

6566
### Running the specs
6667

spec/ruby/command_line/dash_upper_w_spec.rb

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,26 @@
1919
it_behaves_like :command_line_verbose, "-W2"
2020
end
2121

22-
# Regarding the defaults, see core/warning/element_reference_spec.rb
23-
ruby_version_is "2.7" do
24-
describe "The -W command line option with :deprecated" do
25-
it "enables deprecation warnings" do
26-
ruby_exe('p Warning[:deprecated]', options: '-W:deprecated').should == "true\n"
27-
end
22+
describe "The -W command line option with :deprecated" do
23+
it "enables deprecation warnings" do
24+
ruby_exe('p Warning[:deprecated]', options: '-W:deprecated').should == "true\n"
2825
end
26+
end
2927

30-
describe "The -W command line option with :no-deprecated" do
31-
it "suppresses deprecation warnings" do
32-
ruby_exe('p Warning[:deprecated]', options: '-w -W:no-deprecated').should == "false\n"
33-
end
28+
describe "The -W command line option with :no-deprecated" do
29+
it "suppresses deprecation warnings" do
30+
ruby_exe('p Warning[:deprecated]', options: '-w -W:no-deprecated').should == "false\n"
3431
end
32+
end
3533

36-
describe "The -W command line option with :experimental" do
37-
it "enables experimental warnings" do
38-
ruby_exe('p Warning[:experimental]', options: '-W:experimental').should == "true\n"
39-
end
34+
describe "The -W command line option with :experimental" do
35+
it "enables experimental warnings" do
36+
ruby_exe('p Warning[:experimental]', options: '-W:experimental').should == "true\n"
4037
end
38+
end
4139

42-
describe "The -W command line option with :no-experimental" do
43-
it "suppresses experimental warnings" do
44-
ruby_exe('p Warning[:experimental]', options: '-w -W:no-experimental').should == "false\n"
45-
end
40+
describe "The -W command line option with :no-experimental" do
41+
it "suppresses experimental warnings" do
42+
ruby_exe('p Warning[:experimental]', options: '-w -W:no-experimental').should == "false\n"
4643
end
4744
end

spec/ruby/command_line/dash_w_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
describe "The -w command line option" do
55
it_behaves_like :command_line_verbose, "-w"
66

7-
ruby_version_is "2.7" do
8-
it "enables both deprecated and experimental warnings" do
9-
ruby_exe('p Warning[:deprecated]; p Warning[:experimental]', options: '-w').should == "true\ntrue\n"
10-
end
7+
it "enables both deprecated and experimental warnings" do
8+
ruby_exe('p Warning[:deprecated]; p Warning[:experimental]', options: '-w').should == "true\ntrue\n"
119
end
1210
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
p "abc".object_id == "abc".object_id
1+
p "abc".equal?("abc")

spec/ruby/command_line/rubyopt_spec.rb

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,22 @@
5959
ruby_exe("p $VERBOSE", escape: true).chomp.should == "true"
6060
end
6161

62-
ruby_version_is "2.7" do
63-
it "suppresses deprecation warnings for '-W:no-deprecated'" do
64-
ENV["RUBYOPT"] = '-W:no-deprecated'
65-
result = ruby_exe('$; = ""', args: '2>&1')
66-
result.should == ""
67-
end
62+
it "suppresses deprecation warnings for '-W:no-deprecated'" do
63+
ENV["RUBYOPT"] = '-W:no-deprecated'
64+
result = ruby_exe('$; = ""', args: '2>&1')
65+
result.should == ""
66+
end
6867

69-
it "suppresses experimental warnings for '-W:no-experimental'" do
70-
ENV["RUBYOPT"] = '-W:no-experimental'
71-
result = ruby_exe('case 0; in a; end', args: '2>&1')
72-
result.should == ""
73-
end
68+
it "suppresses experimental warnings for '-W:no-experimental'" do
69+
ENV["RUBYOPT"] = '-W:no-experimental'
70+
result = ruby_exe('case 0; in a; end', args: '2>&1')
71+
result.should == ""
72+
end
7473

75-
it "suppresses deprecation and experimental warnings for '-W:no-deprecated -W:no-experimental'" do
76-
ENV["RUBYOPT"] = '-W:no-deprecated -W:no-experimental'
77-
result = ruby_exe('case ($; = ""); in a; end', args: '2>&1')
78-
result.should == ""
79-
end
74+
it "suppresses deprecation and experimental warnings for '-W:no-deprecated -W:no-experimental'" do
75+
ENV["RUBYOPT"] = '-W:no-deprecated -W:no-experimental'
76+
result = ruby_exe('case ($; = ""); in a; end', args: '2>&1')
77+
result.should == ""
8078
end
8179

8280
it "requires the file for '-r'" do

spec/ruby/core/array/clear_spec.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,10 @@
2020
a.size.should == 0
2121
end
2222

23-
ruby_version_is ''...'2.7' do
24-
it "keeps tainted status" do
25-
a = [1]
26-
a.taint
27-
a.tainted?.should be_true
28-
a.clear
29-
a.tainted?.should be_true
30-
end
31-
end
32-
3323
it "does not accept any arguments" do
3424
-> { [1].clear(true) }.should raise_error(ArgumentError)
3525
end
3626

37-
ruby_version_is ''...'2.7' do
38-
it "keeps untrusted status" do
39-
a = [1]
40-
a.untrust
41-
a.untrusted?.should be_true
42-
a.clear
43-
a.untrusted?.should be_true
44-
end
45-
end
46-
4727
it "raises a FrozenError on a frozen array" do
4828
a = [1]
4929
a.freeze

spec/ruby/core/array/compact_spec.rb

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@
2121
it "does not return subclass instance for Array subclasses" do
2222
ArraySpecs::MyArray[1, 2, 3, nil].compact.should be_an_instance_of(Array)
2323
end
24-
25-
ruby_version_is ''...'2.7' do
26-
it "does not keep tainted status even if all elements are removed" do
27-
a = [nil, nil]
28-
a.taint
29-
a.compact.tainted?.should be_false
30-
end
31-
32-
it "does not keep untrusted status even if all elements are removed" do
33-
a = [nil, nil]
34-
a.untrust
35-
a.compact.untrusted?.should be_false
36-
end
37-
end
3824
end
3925

4026
describe "Array#compact!" do
@@ -59,22 +45,6 @@
5945
[1, 2, false, 3].compact!.should == nil
6046
end
6147

62-
ruby_version_is ''...'2.7' do
63-
it "keeps tainted status even if all elements are removed" do
64-
a = [nil, nil]
65-
a.taint
66-
a.compact!
67-
a.tainted?.should be_true
68-
end
69-
70-
it "keeps untrusted status even if all elements are removed" do
71-
a = [nil, nil]
72-
a.untrust
73-
a.compact!
74-
a.untrusted?.should be_true
75-
end
76-
end
77-
7848
it "raises a FrozenError on a frozen array" do
7949
-> { ArraySpecs.frozen_array.compact! }.should raise_error(FrozenError)
8050
end

spec/ruby/core/array/concat_spec.rb

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -41,64 +41,6 @@
4141
-> { ArraySpecs.frozen_array.concat([]) }.should raise_error(FrozenError)
4242
end
4343

44-
ruby_version_is ''...'2.7' do
45-
it "keeps tainted status" do
46-
ary = [1, 2]
47-
ary.taint
48-
ary.concat([3])
49-
ary.tainted?.should be_true
50-
ary.concat([])
51-
ary.tainted?.should be_true
52-
end
53-
54-
it "is not infected by the other" do
55-
ary = [1,2]
56-
other = [3]; other.taint
57-
ary.tainted?.should be_false
58-
ary.concat(other)
59-
ary.tainted?.should be_false
60-
end
61-
62-
it "keeps the tainted status of elements" do
63-
ary = [ Object.new, Object.new, Object.new ]
64-
ary.each {|x| x.taint }
65-
66-
ary.concat([ Object.new ])
67-
ary[0].tainted?.should be_true
68-
ary[1].tainted?.should be_true
69-
ary[2].tainted?.should be_true
70-
ary[3].tainted?.should be_false
71-
end
72-
73-
it "keeps untrusted status" do
74-
ary = [1, 2]
75-
ary.untrust
76-
ary.concat([3])
77-
ary.untrusted?.should be_true
78-
ary.concat([])
79-
ary.untrusted?.should be_true
80-
end
81-
82-
it "is not infected untrustedness by the other" do
83-
ary = [1,2]
84-
other = [3]; other.untrust
85-
ary.untrusted?.should be_false
86-
ary.concat(other)
87-
ary.untrusted?.should be_false
88-
end
89-
90-
it "keeps the untrusted status of elements" do
91-
ary = [ Object.new, Object.new, Object.new ]
92-
ary.each {|x| x.untrust }
93-
94-
ary.concat([ Object.new ])
95-
ary[0].untrusted?.should be_true
96-
ary[1].untrusted?.should be_true
97-
ary[2].untrusted?.should be_true
98-
ary[3].untrusted?.should be_false
99-
end
100-
end
101-
10244
it "appends elements to an Array with enough capacity that has been shifted" do
10345
ary = [1, 2, 3, 4, 5]
10446
2.times { ary.shift }

0 commit comments

Comments
 (0)