Skip to content

Commit 37e0d9f

Browse files
committed
Cleanup minitest deprecation warnings about assert_nil
1 parent 9d453c6 commit 37e0d9f

14 files changed

+77
-80
lines changed

test/test_rdoc_any_method.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def test_marshal_dump
133133
assert_equal 'Klass#method', loaded.full_name
134134
assert_equal 'method', loaded.name
135135
assert_equal 'param', loaded.params
136-
assert_equal nil, loaded.singleton # defaults to nil
136+
assert_nil loaded.singleton # defaults to nil
137137
assert_equal :public, loaded.visibility
138138
assert_equal cm, loaded.parent
139139
assert_equal section, loaded.section
@@ -220,9 +220,9 @@ def test_marshal_load_version_0
220220
assert_equal 'Klass#method', loaded.full_name
221221
assert_equal 'method', loaded.name
222222
assert_equal 'param', loaded.params
223-
assert_equal nil, loaded.singleton # defaults to nil
223+
assert_nil loaded.singleton # defaults to nil
224224
assert_equal :public, loaded.visibility
225-
assert_equal nil, loaded.file
225+
assert_nil loaded.file
226226
assert_equal cm, loaded.parent
227227
assert_equal section, loaded.section
228228
assert_nil loaded.is_alias_for
@@ -277,7 +277,7 @@ def test_marshal_dump_version_2
277277
assert_equal 'Klass#method', loaded.full_name
278278
assert_equal 'method', loaded.name
279279
assert_equal 'param', loaded.params
280-
assert_equal nil, loaded.singleton # defaults to nil
280+
assert_nil loaded.singleton # defaults to nil
281281
assert_equal :public, loaded.visibility
282282
assert_equal cm, loaded.parent
283283
assert_equal section, loaded.section
@@ -480,4 +480,3 @@ def test_superclass_method_multilevel
480480
end
481481

482482
end
483-

test/test_rdoc_attr.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_marshal_load_version_1
139139
assert_equal cm, loaded.parent
140140
assert_equal section, loaded.section
141141

142-
assert loaded.display?
142+
assert loaded.display?
143143
end
144144

145145
def test_marshal_load_version_2
@@ -188,4 +188,3 @@ def test_type
188188
end
189189

190190
end
191-

test/test_rdoc_code_object.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def test_each_parent
213213
end
214214

215215
def test_file_name
216-
assert_equal nil, @co.file_name
216+
assert_nil @co.file_name
217217

218218
@co.record_location @store.add_file 'lib/file.rb'
219219

test/test_rdoc_comment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_extract_call_seq_commented
7777

7878
comment.extract_call_seq m
7979

80-
assert_equal nil, m.call_seq
80+
assert_nil m.call_seq
8181
end
8282

8383
def test_extract_call_seq_no_blank

test/test_rdoc_constant.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_marshal_load
118118
assert_equal cm, loaded.parent
119119
assert_equal section, loaded.section
120120

121-
assert loaded.display?
121+
assert loaded.display?
122122
end
123123

124124
def test_marshal_load_version_0

test/test_rdoc_context.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ def test_initialize
1414
assert_empty @context.in_files
1515
assert_equal 'unknown', @context.name
1616
assert_equal '', @context.comment
17-
assert_equal nil, @context.parent
17+
assert_nil @context.parent
1818
assert_equal :public, @context.visibility
1919
assert_equal 1, @context.sections.length
20-
assert_equal nil, @context.temporary_section
20+
assert_nil @context.temporary_section
2121

2222
assert_empty @context.classes_hash
2323
assert_empty @context.modules_hash
@@ -514,39 +514,39 @@ def test_each_section_enumerator
514514
end
515515

516516
def test_find_attribute_named
517-
assert_equal nil, @c1.find_attribute_named('none')
517+
assert_nil @c1.find_attribute_named('none')
518518
assert_equal 'R', @c1.find_attribute_named('attr').rw
519519
assert_equal 'R', @c1.find_attribute_named('attr_reader').rw
520520
assert_equal 'W', @c1.find_attribute_named('attr_writer').rw
521521
assert_equal 'RW', @c1.find_attribute_named('attr_accessor').rw
522522
end
523523

524524
def test_find_class_method_named
525-
assert_equal nil, @c1.find_class_method_named('none')
525+
assert_nil @c1.find_class_method_named('none')
526526

527527
m = @c1.find_class_method_named('m')
528528
assert_instance_of RDoc::AnyMethod, m
529529
assert m.singleton
530530
end
531531

532532
def test_find_constant_named
533-
assert_equal nil, @c1.find_constant_named('NONE')
533+
assert_nil @c1.find_constant_named('NONE')
534534
assert_equal ':const', @c1.find_constant_named('CONST').value
535535
end
536536

537537
def test_find_enclosing_module_named
538-
assert_equal nil, @c2_c3.find_enclosing_module_named('NONE')
538+
assert_nil @c2_c3.find_enclosing_module_named('NONE')
539539
assert_equal @c1, @c2_c3.find_enclosing_module_named('C1')
540540
assert_equal @c2, @c2_c3.find_enclosing_module_named('C2')
541541
end
542542

543543
def test_find_file_named
544-
assert_equal nil, @c1.find_file_named('nonexistent.rb')
544+
assert_nil @c1.find_file_named('nonexistent.rb')
545545
assert_equal @xref_data, @c1.find_file_named(@file_name)
546546
end
547547

548548
def test_find_instance_method_named
549-
assert_equal nil, @c1.find_instance_method_named('none')
549+
assert_nil @c1.find_instance_method_named('none')
550550

551551
m = @c1.find_instance_method_named('m')
552552
assert_instance_of RDoc::AnyMethod, m

test/test_rdoc_encoding.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,17 @@ def test_class_set_encoding_bad
159159
s = ""
160160
encoding = RDoc::Encoding.detect_encoding s
161161

162-
assert_equal nil, encoding
162+
assert_nil encoding
163163

164164
s = "# vim:set fileencoding=utf-8:\n"
165165
encoding = RDoc::Encoding.detect_encoding s
166166

167-
assert_equal nil, encoding
167+
assert_nil encoding
168168

169169
s = "# vim:set fileencoding=utf-8:\n"
170170
encoding = RDoc::Encoding.detect_encoding s
171171

172-
assert_equal nil, encoding
172+
assert_nil encoding
173173

174174
assert_raises ArgumentError do
175175
s = RDoc::Encoding.detect_encoding "# -*- encoding: undecided -*-\n"

test/test_rdoc_markup_formatter.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,39 +111,39 @@ def test_parse_url
111111

112112
assert_equal 'http', scheme
113113
assert_equal 'example/foo', url
114-
assert_equal nil, id
114+
assert_nil id
115115
end
116116

117117
def test_parse_url_anchor
118118
scheme, url, id = @to.parse_url '#foottext-1'
119119

120-
assert_equal nil, scheme
120+
assert_nil scheme
121121
assert_equal '#foottext-1', url
122-
assert_equal nil, id
122+
assert_nil id
123123
end
124124

125125
def test_parse_url_link
126126
scheme, url, id = @to.parse_url 'link:README.txt'
127127

128128
assert_equal 'link', scheme
129129
assert_equal 'README.txt', url
130-
assert_equal nil, id
130+
assert_nil id
131131
end
132132

133133
def test_parse_url_link_id
134134
scheme, url, id = @to.parse_url 'link:README.txt#label-foo'
135135

136136
assert_equal 'link', scheme
137137
assert_equal 'README.txt#label-foo', url
138-
assert_equal nil, id
138+
assert_nil id
139139
end
140140

141141
def test_parse_url_rdoc_label
142142
scheme, url, id = @to.parse_url 'rdoc-label:foo'
143143

144144
assert_equal 'link', scheme
145145
assert_equal '#foo', url
146-
assert_equal nil, id
146+
assert_nil id
147147

148148
scheme, url, id = @to.parse_url 'rdoc-label:foo:bar'
149149

@@ -157,13 +157,13 @@ def test_parse_url_scheme
157157

158158
assert_equal 'http', scheme
159159
assert_equal 'http://example/foo', url
160-
assert_equal nil, id
160+
assert_nil id
161161

162162
scheme, url, id = @to.parse_url 'https://example/foo'
163163

164164
assert_equal 'https', scheme
165165
assert_equal 'https://example/foo', url
166-
assert_equal nil, id
166+
assert_nil id
167167
end
168168

169169
def test_convert_tt_special
@@ -173,4 +173,3 @@ def test_convert_tt_special
173173
end
174174

175175
end
176-

test/test_rdoc_markup_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ def test_skip
10681068

10691069
assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token
10701070

1071-
assert_equal nil, parser.skip(:NONE, false)
1071+
assert_nil parser.skip(:NONE, false)
10721072

10731073
assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token
10741074
end

test/test_rdoc_parser_c.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def test_do_classes_boot_class_nil
327327

328328
klass = util_get_class content, 'cFoo'
329329
assert_equal "this is the Foo boot class", klass.comment.text
330-
assert_equal nil, klass.superclass
330+
assert_nil klass.superclass
331331
end
332332

333333
def test_do_aliases_missing_class
@@ -1377,7 +1377,7 @@ def test_find_modifiers_nodoc
13771377

13781378
parser.find_modifiers comment, method_obj
13791379

1380-
assert_equal nil, method_obj.document_self
1380+
assert_nil method_obj.document_self
13811381
end
13821382

13831383
def test_find_modifiers_yields

0 commit comments

Comments
 (0)