Skip to content

Commit

Permalink
Cleanup minitest deprecation warnings about assert_nil
Browse files Browse the repository at this point in the history
  • Loading branch information
nbeyer committed Mar 23, 2018
1 parent 9d453c6 commit 37e0d9f
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 80 deletions.
9 changes: 4 additions & 5 deletions test/test_rdoc_any_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_marshal_dump
assert_equal 'Klass#method', loaded.full_name
assert_equal 'method', loaded.name
assert_equal 'param', loaded.params
assert_equal nil, loaded.singleton # defaults to nil
assert_nil loaded.singleton # defaults to nil
assert_equal :public, loaded.visibility
assert_equal cm, loaded.parent
assert_equal section, loaded.section
Expand Down Expand Up @@ -220,9 +220,9 @@ def test_marshal_load_version_0
assert_equal 'Klass#method', loaded.full_name
assert_equal 'method', loaded.name
assert_equal 'param', loaded.params
assert_equal nil, loaded.singleton # defaults to nil
assert_nil loaded.singleton # defaults to nil
assert_equal :public, loaded.visibility
assert_equal nil, loaded.file
assert_nil loaded.file
assert_equal cm, loaded.parent
assert_equal section, loaded.section
assert_nil loaded.is_alias_for
Expand Down Expand Up @@ -277,7 +277,7 @@ def test_marshal_dump_version_2
assert_equal 'Klass#method', loaded.full_name
assert_equal 'method', loaded.name
assert_equal 'param', loaded.params
assert_equal nil, loaded.singleton # defaults to nil
assert_nil loaded.singleton # defaults to nil
assert_equal :public, loaded.visibility
assert_equal cm, loaded.parent
assert_equal section, loaded.section
Expand Down Expand Up @@ -480,4 +480,3 @@ def test_superclass_method_multilevel
end

end

3 changes: 1 addition & 2 deletions test/test_rdoc_attr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_marshal_load_version_1
assert_equal cm, loaded.parent
assert_equal section, loaded.section

assert loaded.display?
assert loaded.display?
end

def test_marshal_load_version_2
Expand Down Expand Up @@ -188,4 +188,3 @@ def test_type
end

end

2 changes: 1 addition & 1 deletion test/test_rdoc_code_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_each_parent
end

def test_file_name
assert_equal nil, @co.file_name
assert_nil @co.file_name

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

Expand Down
2 changes: 1 addition & 1 deletion test/test_rdoc_comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_extract_call_seq_commented

comment.extract_call_seq m

assert_equal nil, m.call_seq
assert_nil m.call_seq
end

def test_extract_call_seq_no_blank
Expand Down
2 changes: 1 addition & 1 deletion test/test_rdoc_constant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_marshal_load
assert_equal cm, loaded.parent
assert_equal section, loaded.section

assert loaded.display?
assert loaded.display?
end

def test_marshal_load_version_0
Expand Down
16 changes: 8 additions & 8 deletions test/test_rdoc_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def test_initialize
assert_empty @context.in_files
assert_equal 'unknown', @context.name
assert_equal '', @context.comment
assert_equal nil, @context.parent
assert_nil @context.parent
assert_equal :public, @context.visibility
assert_equal 1, @context.sections.length
assert_equal nil, @context.temporary_section
assert_nil @context.temporary_section

assert_empty @context.classes_hash
assert_empty @context.modules_hash
Expand Down Expand Up @@ -514,39 +514,39 @@ def test_each_section_enumerator
end

def test_find_attribute_named
assert_equal nil, @c1.find_attribute_named('none')
assert_nil @c1.find_attribute_named('none')
assert_equal 'R', @c1.find_attribute_named('attr').rw
assert_equal 'R', @c1.find_attribute_named('attr_reader').rw
assert_equal 'W', @c1.find_attribute_named('attr_writer').rw
assert_equal 'RW', @c1.find_attribute_named('attr_accessor').rw
end

def test_find_class_method_named
assert_equal nil, @c1.find_class_method_named('none')
assert_nil @c1.find_class_method_named('none')

m = @c1.find_class_method_named('m')
assert_instance_of RDoc::AnyMethod, m
assert m.singleton
end

def test_find_constant_named
assert_equal nil, @c1.find_constant_named('NONE')
assert_nil @c1.find_constant_named('NONE')
assert_equal ':const', @c1.find_constant_named('CONST').value
end

def test_find_enclosing_module_named
assert_equal nil, @c2_c3.find_enclosing_module_named('NONE')
assert_nil @c2_c3.find_enclosing_module_named('NONE')
assert_equal @c1, @c2_c3.find_enclosing_module_named('C1')
assert_equal @c2, @c2_c3.find_enclosing_module_named('C2')
end

def test_find_file_named
assert_equal nil, @c1.find_file_named('nonexistent.rb')
assert_nil @c1.find_file_named('nonexistent.rb')
assert_equal @xref_data, @c1.find_file_named(@file_name)
end

def test_find_instance_method_named
assert_equal nil, @c1.find_instance_method_named('none')
assert_nil @c1.find_instance_method_named('none')

m = @c1.find_instance_method_named('m')
assert_instance_of RDoc::AnyMethod, m
Expand Down
6 changes: 3 additions & 3 deletions test/test_rdoc_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ def test_class_set_encoding_bad
s = ""
encoding = RDoc::Encoding.detect_encoding s

assert_equal nil, encoding
assert_nil encoding

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

assert_equal nil, encoding
assert_nil encoding

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

assert_equal nil, encoding
assert_nil encoding

assert_raises ArgumentError do
s = RDoc::Encoding.detect_encoding "# -*- encoding: undecided -*-\n"
Expand Down
17 changes: 8 additions & 9 deletions test/test_rdoc_markup_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,39 +111,39 @@ def test_parse_url

assert_equal 'http', scheme
assert_equal 'example/foo', url
assert_equal nil, id
assert_nil id
end

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

assert_equal nil, scheme
assert_nil scheme
assert_equal '#foottext-1', url
assert_equal nil, id
assert_nil id
end

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

assert_equal 'link', scheme
assert_equal 'README.txt', url
assert_equal nil, id
assert_nil id
end

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

assert_equal 'link', scheme
assert_equal 'README.txt#label-foo', url
assert_equal nil, id
assert_nil id
end

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

assert_equal 'link', scheme
assert_equal '#foo', url
assert_equal nil, id
assert_nil id

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

Expand All @@ -157,13 +157,13 @@ def test_parse_url_scheme

assert_equal 'http', scheme
assert_equal 'http://example/foo', url
assert_equal nil, id
assert_nil id

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

assert_equal 'https', scheme
assert_equal 'https://example/foo', url
assert_equal nil, id
assert_nil id
end

def test_convert_tt_special
Expand All @@ -173,4 +173,3 @@ def test_convert_tt_special
end

end

2 changes: 1 addition & 1 deletion test/test_rdoc_markup_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ def test_skip

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

assert_equal nil, parser.skip(:NONE, false)
assert_nil parser.skip(:NONE, false)

assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token
end
Expand Down
4 changes: 2 additions & 2 deletions test/test_rdoc_parser_c.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def test_do_classes_boot_class_nil

klass = util_get_class content, 'cFoo'
assert_equal "this is the Foo boot class", klass.comment.text
assert_equal nil, klass.superclass
assert_nil klass.superclass
end

def test_do_aliases_missing_class
Expand Down Expand Up @@ -1377,7 +1377,7 @@ def test_find_modifiers_nodoc

parser.find_modifiers comment, method_obj

assert_equal nil, method_obj.document_self
assert_nil method_obj.document_self
end

def test_find_modifiers_yields
Expand Down

0 comments on commit 37e0d9f

Please sign in to comment.