Add list of methods that will warn when undefined

This commit is contained in:
Dan Kubb 2014-07-06 17:23:57 -07:00
parent 21d5fe5dfb
commit 2c13a79147

View file

@ -7,6 +7,9 @@ module Mutant
NAME_INDEX = 0
SYMBOL = '#'.freeze
# A list of methods that will warn when they are undefined
WARN_METHODS_UNDEFINED = [:initialize, :__send__, :object_id].freeze
# Test if method is public
#
# @return [Boolean]
@ -26,8 +29,8 @@ module Mutant
#
def prepare
expected_warnings =
if RUBY_ENGINE.eql?('ruby') && name.equal?(:initialize)
["#{__FILE__}:#{__LINE__ + 5}: warning: undefining `initialize' may cause serious problems\n"]
if RUBY_ENGINE.eql?('ruby') && WARN_METHODS_UNDEFINED.include?(name)
["#{__FILE__}:#{__LINE__ + 5}: warning: undefining `#{name}' may cause serious problems\n"]
else
[]
end