Skip to content

Commit dad6fcd

Browse files
committed
1 parent 8a4bf5d commit dad6fcd

Some content is hidden

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

62 files changed

+777
-690
lines changed

spec/ruby/.rubocop.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ AllCops:
1010
Layout/TrailingWhitespace:
1111
Enabled: true
1212

13-
Layout/TrailingBlankLines:
13+
Layout/TrailingEmptyLines:
1414
Enabled: true
1515
Exclude:
1616
- library/coverage/fixtures/some_class.rb
@@ -34,10 +34,10 @@ Lint/InterpolationCheck:
3434
Lint/LiteralAsCondition:
3535
Enabled: false
3636

37-
Lint/UnneededRequireStatement:
37+
Lint/RedundantRequireStatement:
3838
Enabled: false
3939

40-
Lint/UnneededSplatExpansion:
40+
Lint/RedundantSplatExpansion:
4141
Enabled: false
4242

4343
Lint/UnifiedInteger:

spec/ruby/.rubocop_todo.yml

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2018-04-03 22:23:59 +0900 using RuboCop version 0.54.0.
3+
# on 2019-12-12 22:16:26 +0900 using RuboCop version 0.77.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -20,22 +20,24 @@ Lint/DuplicateMethods:
2020
- 'core/unboundmethod/fixtures/classes.rb'
2121
- 'fixtures/class.rb'
2222

23-
# Offense count: 5
23+
# Offense count: 8
2424
Lint/EnsureReturn:
2525
Exclude:
2626
- 'language/fixtures/ensure.rb'
2727
- 'language/fixtures/return.rb'
2828
- 'language/return_spec.rb'
2929

30+
# Offense count: 10
31+
Lint/FlipFlop:
32+
Exclude:
33+
- 'language/if_spec.rb'
34+
- 'language/precedence_spec.rb'
35+
3036
# Offense count: 10
3137
Lint/FloatOutOfRange:
3238
Exclude:
3339
- 'core/string/modulo_spec.rb'
3440

35-
# Offense count: 29
36-
Lint/HandleExceptions:
37-
Enabled: false
38-
3941
# Offense count: 2
4042
Lint/ImplicitStringConcatenation:
4143
Exclude:
@@ -58,13 +60,19 @@ Lint/InheritException:
5860
- 'core/exception/fixtures/common.rb'
5961
- 'core/module/fixtures/autoload_ex1.rb'
6062

61-
# Offense count: 5
63+
# Offense count: 72
6264
# Cop supports --auto-correct.
6365
Lint/LiteralInInterpolation:
6466
Exclude:
6567
- 'core/module/refine_spec.rb'
68+
- 'core/regexp/shared/new.rb'
69+
- 'core/string/shared/to_sym.rb'
70+
- 'language/alias_spec.rb'
6671
- 'language/defined_spec.rb'
6772
- 'language/fixtures/squiggly_heredoc.rb'
73+
- 'language/symbol_spec.rb'
74+
- 'language/undef_spec.rb'
75+
- 'library/net/ftp/connect_spec.rb'
6876

6977
# Offense count: 16
7078
Lint/Loop:
@@ -74,25 +82,31 @@ Lint/Loop:
7482

7583
# Offense count: 8
7684
# Cop supports --auto-correct.
77-
Lint/MultipleCompare:
85+
Lint/MultipleComparison:
7886
Exclude:
7987
- 'language/precedence_spec.rb'
8088

81-
# Offense count: 12
89+
# Offense count: 9
8290
Lint/ParenthesesAsGroupedExpression:
8391
Exclude:
8492
- 'core/string/fixtures/freeze_magic_comment.rb'
8593
- 'language/block_spec.rb'
8694
- 'language/fixtures/send.rb'
8795
- 'language/method_spec.rb'
8896

97+
# Offense count: 2
98+
# Cop supports --auto-correct.
99+
Lint/RedundantStringCoercion:
100+
Exclude:
101+
- 'core/io/print_spec.rb'
102+
89103
# Offense count: 1
90104
# Cop supports --auto-correct.
91105
Lint/RedundantWithIndex:
92106
Exclude:
93107
- 'core/enumerator/with_index_spec.rb'
94108

95-
# Offense count: 26
109+
# Offense count: 22
96110
Lint/RescueException:
97111
Exclude:
98112
- 'command_line/fixtures/debug_info.rb'
@@ -102,27 +116,24 @@ Lint/RescueException:
102116
- 'core/kernel/fixtures/autoload_frozen.rb'
103117
- 'core/module/autoload_spec.rb'
104118
- 'core/mutex/sleep_spec.rb'
105-
- 'core/process/euid_spec.rb'
106-
- 'core/process/setsid_spec.rb'
107-
- 'core/process/uid_spec.rb'
108119
- 'core/thread/abort_on_exception_spec.rb'
109120
- 'core/thread/shared/exit.rb'
110121
- 'language/rescue_spec.rb'
111122
- 'library/erb/filename_spec.rb'
112123

113-
# Offense count: 2
124+
# Offense count: 4
114125
# Configuration parameters: IgnoreImplicitReferences.
115126
Lint/ShadowedArgument:
116127
Exclude:
117128
- 'language/fixtures/super.rb'
118129

119-
# Offense count: 2
120-
# Cop supports --auto-correct.
121-
Lint/StringConversionInInterpolation:
122-
Exclude:
123-
- 'core/io/print_spec.rb'
130+
# Offense count: 39
131+
# Configuration parameters: AllowComments.
132+
Lint/SuppressedException:
133+
Enabled: false
124134

125135
# Offense count: 9
136+
# Configuration parameters: AllowKeywordBlockArguments.
126137
Lint/UnderscorePrefixedVariableName:
127138
Exclude:
128139
- 'core/io/pipe_spec.rb'
@@ -137,13 +148,4 @@ Lint/UselessAccessModifier:
137148
- 'core/module/fixtures/classes.rb'
138149
- 'core/module/module_function_spec.rb'
139150
- 'core/module/private_class_method_spec.rb'
140-
- 'core/module/private_spec.rb'
141-
- 'core/module/protected_spec.rb'
142-
- 'core/module/public_spec.rb'
143151
- 'language/fixtures/send.rb'
144-
145-
# Offense count: 6186
146-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
147-
# URISchemes: http, https
148-
Metrics/LineLength:
149-
Max: 588

spec/ruby/core/argf/binmode_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
end
2323
end
2424

25-
it "puts alls subsequent stream reading through ARGF into binmode" do
25+
it "puts all subsequent streams reading through ARGF into binmode" do
2626
argf [@bin_file, @bin_file] do
2727
@argf.binmode
2828
@argf.gets.should == "test\r\n"

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,27 @@
117117
a.send(@method, 0, obj).should == [1, 2]
118118
end
119119

120+
it "raises TypeError if to_int returns non-integer" do
121+
from = mock('from')
122+
to = mock('to')
123+
124+
# So we can construct a range out of them...
125+
def from.<=>(o) 0 end
126+
def to.<=>(o) 0 end
127+
128+
a = [1, 2, 3, 4, 5]
129+
130+
def from.to_int() 'cat' end
131+
def to.to_int() -2 end
132+
133+
-> { a.send(@method, from..to) }.should raise_error(TypeError)
134+
135+
def from.to_int() 1 end
136+
def to.to_int() 'cat' end
137+
138+
-> { a.send(@method, from..to) }.should raise_error(TypeError)
139+
end
140+
120141
it "returns the elements specified by Range indexes with [m..n]" do
121142
[ "a", "b", "c", "d", "e" ].send(@method, 1..3).should == ["b", "c", "d"]
122143
[ "a", "b", "c", "d", "e" ].send(@method, 4..-1).should == ['e']

spec/ruby/core/builtin_constants/builtin_constants_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
end
3737

3838
platform_is :darwin do
39-
it 'contains the current kernel major version' do
40-
kernel_version = `uname -r`
41-
RUBY_PLATFORM.should =~ /#{kernel_version.split('.').first}/
39+
it 'ends with the build time kernel major version on darwin' do
40+
RUBY_PLATFORM.should =~ /-darwin\d+$/
4241
end
4342
end
4443
end

spec/ruby/core/encoding/invalid_byte_sequence_error/incomplete_input_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
require_relative '../../../spec_helper'
33

44
describe "Encoding::InvalidByteSequenceError#incomplete_input?" do
5-
65
it "returns nil by default" do
76
Encoding::InvalidByteSequenceError.new.incomplete_input?.should be_nil
87
end

spec/ruby/core/env/delete_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
ScratchPad.recorded.should == "foo"
3131
end
3232

33-
it "does not evaluate the block if the envirionment variable exists" do
33+
it "does not evaluate the block if the environment variable exists" do
3434
ENV["foo"] = "bar"
3535
ENV.delete("foo") { |name| fail "Should not happen" }
3636
ENV["foo"].should == nil

spec/ruby/core/env/each_pair_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require_relative '../../spec_helper'
1+
require_relative 'spec_helper'
22
require_relative 'shared/each'
33

44
describe "ENV.each_pair" do

spec/ruby/core/env/each_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require_relative '../../spec_helper'
1+
require_relative 'spec_helper'
22
require_relative 'shared/each'
33

44
describe "ENV.each" do

spec/ruby/core/env/each_value_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require_relative '../../spec_helper'
1+
require_relative 'spec_helper'
22
require_relative '../enumerable/shared/enumeratorized'
33

44
describe "ENV.each_value" do
@@ -26,7 +26,7 @@
2626

2727
it "uses the locale encoding" do
2828
ENV.each_value do |value|
29-
value.encoding.should == Encoding.find('locale')
29+
value.should.be_locale_env
3030
end
3131
end
3232

0 commit comments

Comments
 (0)