mutant 0.11.17 → 0.11.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mutant/bootstrap.rb +1 -1
- data/lib/mutant/cli/command/environment/run.rb +1 -1
- data/lib/mutant/mutator/node/literal/regex.rb +8 -8
- data/lib/mutant/mutator/node/send.rb +27 -17
- data/lib/mutant/mutator/regexp.rb +211 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant.rb +1 -18
- metadata +10 -33
- data/lib/mutant/ast/regexp/transformer/direct.rb +0 -145
- data/lib/mutant/ast/regexp/transformer/named_group.rb +0 -50
- data/lib/mutant/ast/regexp/transformer/options_group.rb +0 -68
- data/lib/mutant/ast/regexp/transformer/quantifier.rb +0 -92
- data/lib/mutant/ast/regexp/transformer/recursive.rb +0 -56
- data/lib/mutant/ast/regexp/transformer/root.rb +0 -28
- data/lib/mutant/ast/regexp/transformer/text.rb +0 -58
- data/lib/mutant/ast/regexp/transformer.rb +0 -152
- data/lib/mutant/ast/regexp.rb +0 -54
- data/lib/mutant/mutator/node/regexp/alternation_meta.rb +0 -20
- data/lib/mutant/mutator/node/regexp/beginning_of_line_anchor.rb +0 -20
- data/lib/mutant/mutator/node/regexp/capture_group.rb +0 -23
- data/lib/mutant/mutator/node/regexp/character_type.rb +0 -31
- data/lib/mutant/mutator/node/regexp/end_of_line_anchor.rb +0 -20
- data/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb +0 -20
- data/lib/mutant/mutator/node/regexp/named_group.rb +0 -39
- data/lib/mutant/mutator/node/regexp/zero_or_more.rb +0 -34
- data/lib/mutant/mutator/node/regexp.rb +0 -20
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutant
|
4
|
-
class Mutator
|
5
|
-
class Node
|
6
|
-
module Regexp
|
7
|
-
# Mutator for end of line or before end of string anchor `\Z`
|
8
|
-
class EndOfStringOrBeforeEndOfLineAnchor < Node
|
9
|
-
handle(:regexp_eos_ob_eol_anchor)
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def dispatch
|
14
|
-
emit(s(:regexp_eos_anchor))
|
15
|
-
end
|
16
|
-
end # EndOfStringOrBeforeEndOfLineAnchor
|
17
|
-
end # Regexp
|
18
|
-
end # Node
|
19
|
-
end # Mutator
|
20
|
-
end # Mutant
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutant
|
4
|
-
class Mutator
|
5
|
-
class Node
|
6
|
-
module Regexp
|
7
|
-
# Mutator for regexp named capture groups, such as `/(?<foo>bar)/`
|
8
|
-
class NamedGroup < Node
|
9
|
-
handle(:regexp_named_group)
|
10
|
-
|
11
|
-
children :name
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def dispatch
|
16
|
-
return if remaining_children.empty?
|
17
|
-
|
18
|
-
remaining_children_indices.each(&method(:mutate_child))
|
19
|
-
|
20
|
-
# Allows unused captures to be kept and named if they are explicitly prefixed with an
|
21
|
-
# underscore, like we allow with unused local variables.
|
22
|
-
return if name_underscored?
|
23
|
-
|
24
|
-
emit(s(:regexp_passive_group, *remaining_children))
|
25
|
-
emit_name_underscore_mutation
|
26
|
-
end
|
27
|
-
|
28
|
-
def emit_name_underscore_mutation
|
29
|
-
emit_type("_#{name}", *remaining_children)
|
30
|
-
end
|
31
|
-
|
32
|
-
def name_underscored?
|
33
|
-
name.start_with?('_')
|
34
|
-
end
|
35
|
-
end # EndOfLineAnchor
|
36
|
-
end # Regexp
|
37
|
-
end # Node
|
38
|
-
end # Mutator
|
39
|
-
end # Mutant
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutant
|
4
|
-
class Mutator
|
5
|
-
class Node
|
6
|
-
module Regexp
|
7
|
-
# Mutator for zero-or-more quantifier, `*`
|
8
|
-
class ZeroOrMore < Node
|
9
|
-
MAP = {
|
10
|
-
regexp_greedy_zero_or_more: :regexp_greedy_one_or_more,
|
11
|
-
regexp_reluctant_zero_or_more: :regexp_reluctant_one_or_more,
|
12
|
-
regexp_possessive_zero_or_more: :regexp_possessive_one_or_more
|
13
|
-
}.freeze
|
14
|
-
|
15
|
-
handle(*MAP.keys)
|
16
|
-
|
17
|
-
children :min, :max, :subject
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
# Replace:
|
22
|
-
# * `/a*/` with `/a+/`
|
23
|
-
# * `/a*?/` with `/a+?/`
|
24
|
-
# * `/a*+/` with `/a++/`
|
25
|
-
def dispatch
|
26
|
-
emit(s(MAP.fetch(node.type), *children))
|
27
|
-
emit_subject_mutations
|
28
|
-
emit(subject)
|
29
|
-
end
|
30
|
-
end # ZeroOrMore
|
31
|
-
end # Regexp
|
32
|
-
end # Node
|
33
|
-
end # Mutator
|
34
|
-
end # Mutant
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutant
|
4
|
-
class Mutator
|
5
|
-
class Node
|
6
|
-
module Regexp
|
7
|
-
# Mutator for root expression regexp wrapper
|
8
|
-
class RootExpression < Node
|
9
|
-
handle(:regexp_root_expression)
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def dispatch
|
14
|
-
children.each_index(&method(:mutate_child))
|
15
|
-
end
|
16
|
-
end # RootExpression
|
17
|
-
end # Regexp
|
18
|
-
end # Node
|
19
|
-
end # Mutator
|
20
|
-
end # Mutant
|