Sort regexp nodes lexicographically

- To reduce diff noise in following PRs and have a well-defined ordering
  of nodes.
This commit is contained in:
Daniel Gollahon 2016-10-09 16:46:05 -07:00
parent 5f9cef9ee4
commit 2bbaef5145
No known key found for this signature in database
GPG key ID: B561636FDB951129
3 changed files with 10 additions and 10 deletions

View file

@ -37,17 +37,17 @@ module Mutant
] ]
unsupported_regexp_nodes = AST::Types::REGEXP.to_a - %i[ unsupported_regexp_nodes = AST::Types::REGEXP.to_a - %i[
regexp_root_expression regexp_alternation_meta
regexp_bol_anchor regexp_bol_anchor
regexp_word_type
regexp_nonword_type
regexp_digit_type regexp_digit_type
regexp_nondigit_type regexp_nondigit_type
regexp_space_type
regexp_nonspace_type regexp_nonspace_type
regexp_word_boundary_anchor
regexp_nonword_boundary_anchor regexp_nonword_boundary_anchor
regexp_alternation_meta regexp_nonword_type
regexp_root_expression
regexp_space_type
regexp_word_boundary_anchor
regexp_word_type
] ]
# These nodes still need a dedicated mutator, # These nodes still need a dedicated mutator,

View file

@ -5,10 +5,10 @@ module Mutant
# Character type mutator # Character type mutator
class CharacterType < Node class CharacterType < Node
map = { map = {
regexp_word_type: :regexp_nonword_type,
regexp_digit_type: :regexp_nondigit_type, regexp_digit_type: :regexp_nondigit_type,
regexp_space_type: :regexp_nonspace_type, regexp_space_type: :regexp_nonspace_type,
regexp_word_boundary_anchor: :regexp_nonword_boundary_anchor regexp_word_boundary_anchor: :regexp_nonword_boundary_anchor,
regexp_word_type: :regexp_nonword_type
} }
MAP = IceNine.deep_freeze(map.merge(map.invert)) MAP = IceNine.deep_freeze(map.merge(map.invert))

View file

@ -1,8 +1,8 @@
mutations = { mutations = {
[:regexp_word_type, '/\w/'] => [:regexp_nonword_type, '/\W/'],
[:regexp_digit_type, '/\d/'] => [:regexp_nondigit_type, '/\D/'], [:regexp_digit_type, '/\d/'] => [:regexp_nondigit_type, '/\D/'],
[:regexp_space_type, '/\s/'] => [:regexp_nonspace_type, '/\S/'], [:regexp_space_type, '/\s/'] => [:regexp_nonspace_type, '/\S/'],
[:regexp_word_boundary_anchor, '/\b/'] => [:regexp_nonword_boundary_anchor, '/\B/'] [:regexp_word_boundary_anchor, '/\b/'] => [:regexp_nonword_boundary_anchor, '/\B/'],
[:regexp_word_type, '/\w/'] => [:regexp_nonword_type, '/\W/']
} }
mutations = mutations.merge(mutations.invert) mutations = mutations.merge(mutations.invert)