mutant 0.8.20 → 0.8.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -2
- data/Changelog.md +4 -0
- data/Gemfile.lock +17 -18
- data/README.md +21 -4
- data/config/rubocop.yml +3 -4
- data/docs/mutant-minitest.md +4 -2
- data/docs/mutant-rspec.md +104 -14
- data/lib/mutant.rb +2 -1
- data/lib/mutant/ast/meta/send.rb +1 -15
- data/lib/mutant/ast/types.rb +47 -22
- data/lib/mutant/meta.rb +2 -2
- data/lib/mutant/meta/example.rb +2 -1
- data/lib/mutant/meta/example/dsl.rb +12 -9
- data/lib/mutant/meta/example/verification.rb +34 -16
- data/lib/mutant/mutator/node.rb +7 -0
- data/lib/mutant/mutator/node/argument.rb +0 -1
- data/lib/mutant/mutator/node/arguments.rb +13 -1
- data/lib/mutant/mutator/node/block.rb +1 -1
- data/lib/mutant/mutator/node/index.rb +129 -0
- data/lib/mutant/mutator/node/noop.rb +1 -1
- data/lib/mutant/mutator/node/procarg_zero.rb +45 -0
- data/lib/mutant/mutator/node/send.rb +1 -27
- data/lib/mutant/parser.rb +1 -1
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +34 -32
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warning_filter.rb +1 -1
- data/lib/mutant/zombifier.rb +1 -1
- data/meta/block.rb +22 -3
- data/meta/index.rb +133 -0
- data/meta/indexasgn.rb +31 -0
- data/meta/lambda.rb +9 -0
- data/meta/regexp.rb +0 -7
- data/meta/regexp/character_types.rb +1 -1
- data/meta/send.rb +0 -146
- data/mutant.gemspec +2 -3
- data/spec/spec_helper.rb +1 -1
- data/spec/support/corpus.rb +28 -12
- data/spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb +1 -1
- data/spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb +1 -1
- data/spec/unit/mutant/ast/meta/send_spec.rb +6 -8
- data/spec/unit/mutant/meta/example/dsl_spec.rb +9 -9
- data/spec/unit/mutant/meta/example/verification_spec.rb +36 -4
- data/spec/unit/mutant/meta/example_spec.rb +4 -4
- data/spec/unit/mutant/mutator/node_spec.rb +12 -7
- data/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +3 -1
- data/spec/unit/mutant/subject_spec.rb +1 -1
- data/spec/unit/mutant/zombifier_spec.rb +1 -1
- metadata +12 -24
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/lib/mutant/mutator/node/send/index.rb +0 -52
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutant
|
4
|
-
class Mutator
|
5
|
-
class Node
|
6
|
-
class Send
|
7
|
-
# Base mutator for index operations
|
8
|
-
class Index < self
|
9
|
-
|
10
|
-
# Mutator for index assignments
|
11
|
-
class Assign < self
|
12
|
-
|
13
|
-
define_named_child(:value, -1)
|
14
|
-
|
15
|
-
INDEX_RANGE = (2..-2).freeze
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
# Emit mutations
|
20
|
-
#
|
21
|
-
# @return [undefined]
|
22
|
-
def dispatch
|
23
|
-
emit_naked_receiver
|
24
|
-
emit_value_mutations
|
25
|
-
emit_index_read
|
26
|
-
emit(value)
|
27
|
-
mutate_indices
|
28
|
-
end
|
29
|
-
|
30
|
-
# Mutate indices
|
31
|
-
#
|
32
|
-
# @return [undefined]
|
33
|
-
def mutate_indices
|
34
|
-
children_indices(INDEX_RANGE).each do |index|
|
35
|
-
delete_child(index)
|
36
|
-
mutate_child(index)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# Emit index read
|
41
|
-
#
|
42
|
-
# @return [undefined]
|
43
|
-
def emit_index_read
|
44
|
-
emit_type(receiver, :[], *children[INDEX_RANGE])
|
45
|
-
end
|
46
|
-
|
47
|
-
end # Assign
|
48
|
-
end # Index
|
49
|
-
end # Send
|
50
|
-
end # Node
|
51
|
-
end # Mutator
|
52
|
-
end # Mutant
|