diff --git a/lib/mutant/constants.rb b/lib/mutant/constants.rb index 8998424d..f9cfd249 100644 --- a/lib/mutant/constants.rb +++ b/lib/mutant/constants.rb @@ -55,8 +55,7 @@ module Mutant :return, :splat, :not, :defined?, :op_asgn, :self, :true, :false, :nil, :dstr, :dsym, :regexp, :regopt, :int, :str, :float, :sym, :pair, :hash, :array, - :xstr, :dyn_str_body, :dyn_regexp_body, :dyn_xstr_body, - :def, :defs, :case, :when, :ivar, :lvar, :cvar, :gvar, + :xstr, :def, :defs, :case, :when, :ivar, :lvar, :cvar, :gvar, :back_ref, :const, :nth_ref, :class, :sclass, :yield, :match_with_lvasgn, :match_current_line, :irange, :erange ].to_set.freeze diff --git a/lib/mutant/mutator/node/noop.rb b/lib/mutant/mutator/node/noop.rb index b35bb095..764ba277 100644 --- a/lib/mutant/mutator/node/noop.rb +++ b/lib/mutant/mutator/node/noop.rb @@ -5,12 +5,18 @@ module Mutant class Noop < self # Literal references to self do not need to be mutated? + handle(:self) + + # These nodes still need a mutator, your contribution is that close! handle( - :self, :zsuper, :not, :or, :and, :defined, - :next, :break, :match, :gvar, :cvar, :ensure, :rescue, - :dstr, :dsym, :yield, :begin, :rescue, :gvasgn, - :lvar, :splat, :const, :blockarg, :block_pass, - :ivar, :restarg + :zsuper, :not, :or, :and, :defined, + :next, :break, :match, :gvar, :cvar, :ensure, + :dstr, :dsym, :yield, :rescue, :redo, :defined?, + :lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :regopt, + :ivar, :restarg, :casgn, :masgn, :resbody, :retry, :arg_expr, + :kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty, + :alias, :for, :xstr, :back_ref, :nth_ref, :class, :sclass, :match_with_lvasgn, + :match_current_line ) private diff --git a/spec/integration/mutant/test_mutator_handles_types_spec.rb b/spec/integration/mutant/test_mutator_handles_types_spec.rb new file mode 100644 index 00000000..e04c7958 --- /dev/null +++ b/spec/integration/mutant/test_mutator_handles_types_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe Mutant do + specify 'mutant should not crash for any node parser can generate' do + Mutant::NODE_TYPES.each do |type| + Mutant::Mutator::Node::Registry.lookup(Mutant::NodeHelpers.s(type)) + end + end +end