Merge pull request #647 from dgollahon/feature/hex_character_class_mutations

Add \h -> \H and \H -> \h mutations
This commit is contained in:
Dan Kubb 2016-10-09 17:24:34 -07:00 committed by GitHub
commit 8bf5f6505c
4 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,3 @@
---
threshold: 16
total_score: 1312
total_score: 1303

View file

@ -41,7 +41,9 @@ module Mutant
regexp_bol_anchor
regexp_digit_type
regexp_eol_anchor
regexp_hex_type
regexp_nondigit_type
regexp_nonhex_type
regexp_nonspace_type
regexp_nonword_boundary_anchor
regexp_nonword_type

View file

@ -6,6 +6,7 @@ module Mutant
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

View file

@ -1,5 +1,6 @@
mutations = {
[:regexp_digit_type, '/\d/'] => [:regexp_nondigit_type, '/\D/'],
[:regexp_hex_type, '/\h/'] => [:regexp_nonhex_type, '/\H/'],
[:regexp_space_type, '/\s/'] => [:regexp_nonspace_type, '/\S/'],
[:regexp_word_boundary_anchor, '/\b/'] => [:regexp_nonword_boundary_anchor, '/\B/'],
[:regexp_word_type, '/\w/'] => [:regexp_nonword_type, '/\W/']