Sha256: 9ae8eb27df78ecc55c0cc3ac1097f8ac7120a60271675e353a8357b0b6b3b189

Contents?: true

Size: 837 Bytes

Versions: 8

Compression:

Stored size: 837 Bytes

Contents

module Mutest
  class Mutator
    class Node
      module Regexp
        # Character type mutator
        class CharacterType < Node
          map = {
            regexp_digit_type:           :regexp_nondigit_type,
            regexp_hex_type:             :regexp_nonhex_type,
            regexp_space_type:           :regexp_nonspace_type,
            regexp_word_boundary_anchor: :regexp_nonword_boundary_anchor,
            regexp_word_type:            :regexp_nonword_type
          }

          MAP = IceNine.deep_freeze(map.merge(map.invert))

          handle(*MAP.keys)

          # Mutate to invert character type
          #
          # @return [undefined]
          def dispatch
            emit(s(MAP.fetch(node.type)))
          end
        end # CharacterType
      end # Regexp
    end # Node
  end # Mutator
end # Mutest

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutest-0.0.9 lib/mutest/mutator/node/regexp/character_type.rb
mutest-0.0.8 lib/mutest/mutator/node/regexp/character_type.rb
mutest-0.0.7 lib/mutest/mutator/node/regexp/character_type.rb
mutest-0.0.6 lib/mutest/mutator/node/regexp/character_type.rb
mutest-0.0.5 lib/mutest/mutator/node/regexp/character_type.rb
mutest-0.0.4 lib/mutest/mutator/node/regexp/character_type.rb
mutest-0.0.3 lib/mutest/mutator/node/regexp/character_type.rb
mutest-0.0.2 lib/mutest/mutator/node/regexp/character_type.rb