Sha256: 28441810d70f7c82b2dac674cf22a4a7f93457ec3e956ce8af055eac1599ff7a

Contents?: true

Size: 1.86 KB

Versions: 5

Compression:

Stored size: 1.86 KB

Contents

module Mutest
  class Mutator
    class Node
      # Generic mutator
      class Generic < self
        unsupported_nodes = %i[
          ensure
          redo
          retry
          arg_expr
          blockarg
          undef
          module
          empty
          alias
          for
          xstr
          back_ref
          sclass
          match_with_lvasgn
          while_post
          until_post
          preexe
          postexe
          iflipflop
          eflipflop
          kwsplat
          shadowarg
          rational
          complex
          __FILE__
          __LINE__
        ]

        unsupported_regexp_nodes = AST::Types::REGEXP.to_a - %i[
          regexp_alternation_meta
          regexp_bol_anchor
          regexp_capture_group
          regexp_digit_type
          regexp_eol_anchor
          regexp_eos_ob_eol_anchor
          regexp_greedy_one_or_more
          regexp_greedy_zero_or_more
          regexp_hex_type
          regexp_nondigit_type
          regexp_nonhex_type
          regexp_nonspace_type
          regexp_nonword_boundary_anchor
          regexp_nonword_type
          regexp_possessive_one_or_more
          regexp_possessive_zero_or_more
          regexp_reluctant_one_or_more
          regexp_reluctant_zero_or_more
          regexp_root_expression
          regexp_space_type
          regexp_word_boundary_anchor
          regexp_word_type
        ]

        # These nodes still need a dedicated mutator,
        # your contribution is that close!
        handle(*(unsupported_nodes + unsupported_regexp_nodes))

        private

        # Emit mutations
        #
        # @return [undefined]
        def dispatch
          children.each_with_index do |child, index|
            mutate_child(index) if child.instance_of?(::Parser::AST::Node)
          end
        end
      end # Generic
    end # Node
  end # Mutator
end # Mutest

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutest-0.0.6 lib/mutest/mutator/node/generic.rb
mutest-0.0.5 lib/mutest/mutator/node/generic.rb
mutest-0.0.4 lib/mutest/mutator/node/generic.rb
mutest-0.0.3 lib/mutest/mutator/node/generic.rb
mutest-0.0.2 lib/mutest/mutator/node/generic.rb