mutant 0.3.1 → 0.3.2
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/Changelog.md +9 -0
- data/Gemfile +4 -6
- data/Gemfile.devtools +65 -0
- data/Rakefile +2 -2
- data/config/devtools.yml +2 -0
- data/config/flay.yml +1 -1
- data/config/rubocop.yml +8 -9
- data/lib/mutant.rb +26 -3
- data/lib/mutant/cli/builder.rb +0 -11
- data/lib/mutant/constants.rb +12 -18
- data/lib/mutant/loader.rb +7 -16
- data/lib/mutant/mutation.rb +1 -1
- data/lib/mutant/mutator/node/binary.rb +58 -0
- data/lib/mutant/mutator/node/{while.rb → conditional_loop.rb} +2 -2
- data/lib/mutant/mutator/node/generic.rb +2 -1
- data/lib/mutant/node_helpers.rb +1 -1
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/zombifier.rb +2 -1
- data/mutant.gemspec +4 -3
- data/spec/integration/mutant/test_mutator_handles_types_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/mutant/cli/classifier/method_spec.rb +1 -1
- data/spec/unit/mutant/cli/classifier/namespace/flat_spec.rb +2 -2
- data/spec/unit/mutant/cli/classifier/namespace/recursive_spec.rb +2 -2
- data/spec/unit/mutant/differ_spec.rb +42 -0
- data/spec/unit/mutant/killer/{rspec/class_methods/new_spec.rb → rspec_spec.rb} +0 -0
- data/spec/unit/mutant/loader/{eval/class_methods/run_spec.rb → eval_spec.rb} +2 -2
- data/spec/unit/mutant/matcher/chain_spec.rb +57 -0
- data/spec/unit/mutant/matcher/method/instance_spec.rb +155 -0
- data/spec/unit/mutant/matcher/method/{singleton/each_spec.rb → singleton_spec.rb} +0 -0
- data/spec/unit/mutant/matcher/methods/{instance/each_spec.rb → instance_spec.rb} +0 -0
- data/spec/unit/mutant/matcher/methods/{singleton/each_spec.rb → singleton_spec.rb} +0 -0
- data/spec/unit/mutant/matcher/{namespace/each_spec.rb → namespace_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{and_asgn/mutation_spec.rb → and_asgn_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{begin/mutation_spec.rb → begin_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{connective/binary/mutation_spec.rb → binary_spec.rb} +1 -1
- data/spec/unit/mutant/mutator/node/{block_pass/mutation_spec.rb → block_pass_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{block/mutation_spec.rb → block_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{blockarg/mutation_spec.rb → blockarg_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{case/mutation_spec.rb → case_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{cbase/mutation_spec.rb → cbase_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/conditional_loop_spec.rb +42 -0
- data/spec/unit/mutant/mutator/node/{const/mutation_spec.rb → const_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{define/mutation_spec.rb → define_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{defined_predicate/mutation_spec.rb → defined_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{dstr/mutation_spec.rb → dstr_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{dsym/mutation_spec.rb → dsym_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{ensure/mutation_spec.rb → ensure_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{if/mutation_spec.rb → if_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{kwbegin/mutation_spec.rb → kwbegin_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/literal/{boolean/mutation_spec.rb → boolean_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{masgn/mutation_spec.rb → masgn_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{match_current_line/mutation_spec.rb → match_current_line_spec.rb} +1 -1
- data/spec/unit/mutant/mutator/node/named_value/{access/mutation_spec.rb → access_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/named_value/{constant_assignment/mutation_spec.rb → constant_assignment_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/named_value/{variable_assignment/mutation_spec.rb → variable_assignment_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{nthref/mutation_spec.rb → nthref_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{op_assgn/mutation_spec.rb → op_assgn_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{or_asgn/mutation_spec.rb → or_asgn_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{redo/mutation_spec.rb → redo_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{rescue/mutation_spec.rb → rescue_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{restarg/mutation_spec.rb → restarg_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{return/mutation_spec.rb → return_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{send/mutation_spec.rb → send_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{super/mutation_spec.rb → super_spec.rb} +0 -0
- data/spec/unit/mutant/mutator/node/{yield/mutation_spec.rb → yield_spec.rb} +0 -0
- data/spec/unit/mutant/mutator_spec.rb +29 -0
- data/spec/unit/mutant/runner/config_spec.rb +88 -0
- data/spec/unit/mutant/runner/{subject/success_predicate_spec.rb → subject_spec.rb} +0 -0
- data/spec/unit/mutant_spec.rb +43 -0
- data/test_app/Gemfile.devtools +65 -0
- metadata +119 -119
- data/lib/mutant/mutator/node/connective/binary.rb +0 -61
- data/lib/mutant/support/method_object.rb +0 -34
- data/spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb +0 -41
- data/spec/unit/mutant/differ/class_methods/build_spec.rb +0 -14
- data/spec/unit/mutant/differ/class_methods/colorize_line_spec.rb +0 -27
- data/spec/unit/mutant/matcher/chain/each_spec.rb +0 -43
- data/spec/unit/mutant/matcher/chain/matchers_spec.rb +0 -14
- data/spec/unit/mutant/matcher/each_spec.rb +0 -21
- data/spec/unit/mutant/matcher/method/instance/class_methods/build_spec.rb +0 -42
- data/spec/unit/mutant/matcher/method/instance/each_spec.rb +0 -114
- data/spec/unit/mutant/mutator/each_spec.rb +0 -27
- data/spec/unit/mutant/mutator/emit_new_spec.rb +0 -59
- data/spec/unit/mutant/mutator/emit_spec.rb +0 -55
- data/spec/unit/mutant/mutator/node/while/mutation_spec.rb +0 -24
- data/spec/unit/mutant/node_helpers/n_not_spec.rb +0 -14
- data/spec/unit/mutant/runner/config/subjects_spec.rb +0 -52
- data/spec/unit/mutant/runner/config/success_predicate_spec.rb +0 -57
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e280c60019ecc32329702fe88d92f9d4b3cecee3
|
|
4
|
+
data.tar.gz: b50a351a93d04b9edad1aa75f4e90778009abd21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5d1a4c2c5906b2444e1133cf31b057a570258d5fa32ee4cc08642ddf74111ef8f860ea2d9bd8f1a8e0f7d9e97f88c5671ea928c3e81ba7cbf650c1588ef4de8
|
|
7
|
+
data.tar.gz: c285616c375874b12af6097e12b6e6386b83c0c70faf8e409f63a03ba9c7f9140f5bd14ce3491439e0c161d17f739d91ac96abc6628d62bff20d673098a72da5
|
data/Changelog.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# v0.3.2 2013-12-31
|
|
2
|
+
|
|
3
|
+
Bugfixes:
|
|
4
|
+
|
|
5
|
+
* Fix crash on until nodes: https://github.com/mbj/mutant/issues/143
|
|
6
|
+
* Fix missing requires: https://github.com/mbj/mutant/issues/141
|
|
7
|
+
* Fix crash on unknown nodes, fixes #143
|
|
8
|
+
* Use more durable unparser version 0.1.6
|
|
9
|
+
|
|
1
10
|
# v0.3.1 2013-12-19
|
|
2
11
|
|
|
3
12
|
Bugfixes:
|
data/Gemfile
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
source 'https://rubygems.org'
|
|
4
4
|
|
|
5
|
-
gemspec
|
|
6
|
-
|
|
7
5
|
gem 'mutant', path: '.'
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
gemspec
|
|
8
|
+
|
|
9
|
+
gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
|
|
10
|
+
eval_gemfile 'Gemfile.devtools'
|
data/Gemfile.devtools
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
group :development do
|
|
4
|
+
gem 'rake', '~> 10.1.0'
|
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
|
6
|
+
gem 'yard', '~> 0.8.7'
|
|
7
|
+
|
|
8
|
+
platform :rbx do
|
|
9
|
+
gem 'rubysl-singleton', '~> 2.0.0'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
group :yard do
|
|
14
|
+
gem 'kramdown', '~> 1.3.0'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
group :guard do
|
|
18
|
+
gem 'guard', '~> 2.2.4'
|
|
19
|
+
gem 'guard-bundler', '~> 2.0.0'
|
|
20
|
+
gem 'guard-rspec', '~> 4.2.0'
|
|
21
|
+
gem 'guard-rubocop', '~> 1.0.0'
|
|
22
|
+
|
|
23
|
+
# file system change event handling
|
|
24
|
+
gem 'listen', '~> 2.4.0'
|
|
25
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
|
26
|
+
gem 'rb-fsevent', '~> 0.9.3', require: false
|
|
27
|
+
gem 'rb-inotify', '~> 0.9.0', require: false
|
|
28
|
+
|
|
29
|
+
# notification handling
|
|
30
|
+
gem 'libnotify', '~> 0.8.0', require: false
|
|
31
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
|
32
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
group :metrics do
|
|
36
|
+
gem 'coveralls', '~> 0.7.0'
|
|
37
|
+
gem 'flay', '~> 2.4.0'
|
|
38
|
+
gem 'flog', '~> 4.2.0'
|
|
39
|
+
gem 'reek', '~> 1.3.2'
|
|
40
|
+
gem 'rubocop', '~> 0.16.0'
|
|
41
|
+
gem 'simplecov', '~> 0.8.2'
|
|
42
|
+
gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
|
|
43
|
+
|
|
44
|
+
platforms :ruby_19, :ruby_20 do
|
|
45
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
platform :rbx do
|
|
49
|
+
gem 'json', '~> 1.8.1'
|
|
50
|
+
gem 'racc', '~> 1.4.10'
|
|
51
|
+
gem 'rubysl-logger', '~> 2.0.0'
|
|
52
|
+
gem 'rubysl-open-uri', '~> 2.0.0'
|
|
53
|
+
gem 'rubysl-prettyprint', '~> 2.0.2'
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
group :benchmarks do
|
|
58
|
+
gem 'rbench', '~> 0.2.3'
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
platform :jruby do
|
|
62
|
+
group :jruby do
|
|
63
|
+
gem 'jruby-openssl', '~> 0.8.5'
|
|
64
|
+
end
|
|
65
|
+
end
|
data/Rakefile
CHANGED
data/config/devtools.yml
ADDED
data/config/flay.yml
CHANGED
data/config/rubocop.yml
CHANGED
|
@@ -31,15 +31,6 @@ CollectionMethods:
|
|
|
31
31
|
find: 'detect'
|
|
32
32
|
find_all: 'select'
|
|
33
33
|
|
|
34
|
-
# Do not force public/protected/private keyword to be indented at the same
|
|
35
|
-
# level as the def keyword. My personal preference is to outdent these keywords
|
|
36
|
-
# because I think when scanning code it makes it easier to identify the
|
|
37
|
-
# sections of code and visually separate them. When the keyword is at the same
|
|
38
|
-
# level I think it sort of blends in with the def keywords and makes it harder
|
|
39
|
-
# to scan the code and see where the sections are.
|
|
40
|
-
AccessControl:
|
|
41
|
-
Enabled: false
|
|
42
|
-
|
|
43
34
|
MethodLength:
|
|
44
35
|
CountComments: false
|
|
45
36
|
Max: 17 # TODO: Bring down to 10
|
|
@@ -104,3 +95,11 @@ ClassLength:
|
|
|
104
95
|
# I align private keywords with class body
|
|
105
96
|
IndentationWidth:
|
|
106
97
|
Enabled: false
|
|
98
|
+
|
|
99
|
+
# I like to have an empty line before closing the currently opened body
|
|
100
|
+
EmptyLinesAroundBody:
|
|
101
|
+
Enabled: false
|
|
102
|
+
|
|
103
|
+
# I like my style more
|
|
104
|
+
AccessModifierIndentation:
|
|
105
|
+
Enabled: false
|
data/lib/mutant.rb
CHANGED
|
@@ -22,6 +22,30 @@ require 'anima'
|
|
|
22
22
|
require 'concord'
|
|
23
23
|
require 'rspec'
|
|
24
24
|
|
|
25
|
+
# Monkeypatch on parser with a list of allowed nodes.
|
|
26
|
+
# Will be pushed upstream once turning out to be correct.
|
|
27
|
+
module Parser
|
|
28
|
+
module Meta
|
|
29
|
+
NODE_TYPES =
|
|
30
|
+
%w(
|
|
31
|
+
true false nil int float str dstr str
|
|
32
|
+
sym dsym xstr regopt regexp array splat
|
|
33
|
+
array pair kwsplat hash irange erange self
|
|
34
|
+
lvar ivar cvar gvar const defined? lvasgn
|
|
35
|
+
ivasgn cvasgn gvasgn casgn mlhs masgn op_asgn
|
|
36
|
+
op_asgn and_asgn ensure rescue arg_expr
|
|
37
|
+
or_asgn and_asgn or_asgn back_ref nth_ref
|
|
38
|
+
match_with_lvasgn match_current_line
|
|
39
|
+
module class sclass def defs undef alias args
|
|
40
|
+
cbase arg optarg restarg blockarg block_pass args def kwarg kwoptarg
|
|
41
|
+
kwrestarg send super zsuper yield block send
|
|
42
|
+
and not or if when case while until while_post
|
|
43
|
+
until_post for break next redo return resbody
|
|
44
|
+
kwbegin begin retry preexe postexe iflipflop eflipflop
|
|
45
|
+
).map(&:to_sym).to_set.freeze
|
|
46
|
+
end # Meta
|
|
47
|
+
end # Parser
|
|
48
|
+
|
|
25
49
|
# Library namespace
|
|
26
50
|
module Mutant
|
|
27
51
|
# The empty string used within this namespace
|
|
@@ -33,7 +57,6 @@ require 'mutant/cache'
|
|
|
33
57
|
require 'mutant/node_helpers'
|
|
34
58
|
require 'mutant/singleton_methods'
|
|
35
59
|
require 'mutant/constants'
|
|
36
|
-
require 'mutant/support/method_object'
|
|
37
60
|
require 'mutant/random'
|
|
38
61
|
require 'mutant/predicate'
|
|
39
62
|
require 'mutant/predicate/attribute'
|
|
@@ -65,7 +88,7 @@ require 'mutant/mutator/node/argument'
|
|
|
65
88
|
require 'mutant/mutator/node/arguments'
|
|
66
89
|
require 'mutant/mutator/node/blockarg'
|
|
67
90
|
require 'mutant/mutator/node/begin'
|
|
68
|
-
require 'mutant/mutator/node/
|
|
91
|
+
require 'mutant/mutator/node/binary'
|
|
69
92
|
require 'mutant/mutator/node/const'
|
|
70
93
|
require 'mutant/mutator/node/dstr'
|
|
71
94
|
require 'mutant/mutator/node/dsym'
|
|
@@ -76,7 +99,7 @@ require 'mutant/mutator/node/named_value/variable_assignment'
|
|
|
76
99
|
require 'mutant/mutator/node/loop_control'
|
|
77
100
|
require 'mutant/mutator/node/noop'
|
|
78
101
|
require 'mutant/mutator/node/op_asgn'
|
|
79
|
-
require 'mutant/mutator/node/
|
|
102
|
+
require 'mutant/mutator/node/conditional_loop'
|
|
80
103
|
require 'mutant/mutator/node/yield'
|
|
81
104
|
require 'mutant/mutator/node/super'
|
|
82
105
|
require 'mutant/mutator/node/zsuper'
|
data/lib/mutant/cli/builder.rb
CHANGED
data/lib/mutant/constants.rb
CHANGED
|
@@ -35,25 +35,19 @@ module Mutant
|
|
|
35
35
|
METHOD_OPERATORS + INDEX_OPERATORS + UNARY_METHOD_OPERATORS
|
|
36
36
|
).to_set.freeze
|
|
37
37
|
|
|
38
|
-
#
|
|
38
|
+
# Nodes that are NOT handled by mutant.
|
|
39
39
|
#
|
|
40
|
-
#
|
|
40
|
+
# not - 1.8 only, mutant does not support 1.8
|
|
41
41
|
#
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
:regopt, :int, :str, :float, :sym, :pair, :hash, :array,
|
|
53
|
-
:xstr, :def, :defs, :case, :when, :ivar, :lvar, :cvar, :gvar,
|
|
54
|
-
:back_ref, :const, :nth_ref, :class, :sclass, :yield,
|
|
55
|
-
:match_with_lvasgn, :match_current_line, :irange, :erange,
|
|
56
|
-
:or_asgn, :kwbegin, :and_asgn, :while
|
|
57
|
-
].to_set.freeze
|
|
42
|
+
NODE_BLACKLIST = %w(
|
|
43
|
+
not
|
|
44
|
+
).map(&:to_sym).freeze
|
|
45
|
+
|
|
46
|
+
# Nodes that are NOT generated by parser but used by mutant / unparser.
|
|
47
|
+
NODE_EXTRA = %w(
|
|
48
|
+
empty
|
|
49
|
+
).map(&:to_sym).freeze
|
|
50
|
+
|
|
51
|
+
NODE_TYPES = ((Parser::Meta::NODE_TYPES + NODE_EXTRA) - NODE_BLACKLIST).to_set.freeze
|
|
58
52
|
|
|
59
53
|
end # Mutant
|
data/lib/mutant/loader.rb
CHANGED
|
@@ -4,17 +4,7 @@ module Mutant
|
|
|
4
4
|
# Base class for code loaders
|
|
5
5
|
class Loader
|
|
6
6
|
include AbstractType
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
# Run the loader
|
|
12
|
-
#
|
|
13
|
-
# @return [undefined]
|
|
14
|
-
#
|
|
15
|
-
# @api private
|
|
16
|
-
#
|
|
17
|
-
abstract_method :run
|
|
7
|
+
include Procto.call
|
|
18
8
|
|
|
19
9
|
# Initialize and insert mutation into vm
|
|
20
10
|
#
|
|
@@ -27,29 +17,29 @@ module Mutant
|
|
|
27
17
|
#
|
|
28
18
|
def initialize(root, subject)
|
|
29
19
|
@root, @subject = root, subject
|
|
30
|
-
run
|
|
31
20
|
end
|
|
32
21
|
|
|
33
22
|
# Eval based loader
|
|
34
23
|
class Eval < self
|
|
35
24
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# Run loader
|
|
25
|
+
# Call loader
|
|
39
26
|
#
|
|
40
27
|
# @return [undefined]
|
|
41
28
|
#
|
|
42
29
|
# @api private
|
|
43
30
|
#
|
|
44
|
-
def
|
|
31
|
+
def call
|
|
45
32
|
eval(
|
|
46
33
|
source,
|
|
47
34
|
TOPLEVEL_BINDING,
|
|
48
35
|
@subject.source_path.to_s,
|
|
49
36
|
@subject.source_line
|
|
50
37
|
)
|
|
38
|
+
nil
|
|
51
39
|
end
|
|
52
40
|
|
|
41
|
+
private
|
|
42
|
+
|
|
53
43
|
# Return source
|
|
54
44
|
#
|
|
55
45
|
# @return [String]
|
|
@@ -59,6 +49,7 @@ module Mutant
|
|
|
59
49
|
def source
|
|
60
50
|
Unparser.unparse(@root)
|
|
61
51
|
end
|
|
52
|
+
|
|
62
53
|
end # Eval
|
|
63
54
|
|
|
64
55
|
end # Loader
|
data/lib/mutant/mutation.rb
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Mutant
|
|
4
|
+
class Mutator
|
|
5
|
+
class Node
|
|
6
|
+
# Mutation emitter to handle binary connectives
|
|
7
|
+
class Binary < self
|
|
8
|
+
|
|
9
|
+
INVERSE = {
|
|
10
|
+
and: :or,
|
|
11
|
+
or: :and
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
handle(*INVERSE.keys)
|
|
15
|
+
|
|
16
|
+
children :left, :right
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
# Emit mutations
|
|
21
|
+
#
|
|
22
|
+
# @return [undefined]
|
|
23
|
+
#
|
|
24
|
+
# @api private
|
|
25
|
+
#
|
|
26
|
+
def dispatch
|
|
27
|
+
emit_nil
|
|
28
|
+
emit(left)
|
|
29
|
+
emit(right)
|
|
30
|
+
mutate_operator
|
|
31
|
+
mutate_operands
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Emit operator mutations
|
|
35
|
+
#
|
|
36
|
+
# @return [undefined]
|
|
37
|
+
#
|
|
38
|
+
# @api private
|
|
39
|
+
#
|
|
40
|
+
def mutate_operator
|
|
41
|
+
emit(s(INVERSE.fetch(node.type), left, right))
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Emit condition mutations
|
|
45
|
+
#
|
|
46
|
+
# @return [undefined]
|
|
47
|
+
#
|
|
48
|
+
# @api private
|
|
49
|
+
#
|
|
50
|
+
def mutate_operands
|
|
51
|
+
emit(s(node.type, n_not(left), right))
|
|
52
|
+
emit(n_not(node))
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end # Binary
|
|
56
|
+
end # Node
|
|
57
|
+
end # Mutator
|
|
58
|
+
end # Mutant
|
|
@@ -15,7 +15,8 @@ module Mutant
|
|
|
15
15
|
:regopt, :retry, :arg_expr,
|
|
16
16
|
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :empty,
|
|
17
17
|
:alias, :for, :xstr, :back_ref, :class,
|
|
18
|
-
:sclass, :match_with_lvasgn, :match_current_line
|
|
18
|
+
:sclass, :match_with_lvasgn, :match_current_line, :while_post,
|
|
19
|
+
:until_post, :preexe, :postexe, :iflipflop, :eflipflop, :kwsplat
|
|
19
20
|
)
|
|
20
21
|
|
|
21
22
|
private
|
data/lib/mutant/node_helpers.rb
CHANGED
data/lib/mutant/version.rb
CHANGED
data/lib/mutant/zombifier.rb
CHANGED
|
@@ -16,6 +16,7 @@ module Mutant
|
|
|
16
16
|
rspec
|
|
17
17
|
diff/lcs
|
|
18
18
|
diff/lcs/hunk
|
|
19
|
+
unparser
|
|
19
20
|
parser
|
|
20
21
|
parser/all
|
|
21
22
|
parser/current
|
|
@@ -71,7 +72,7 @@ module Mutant
|
|
|
71
72
|
#
|
|
72
73
|
def zombify
|
|
73
74
|
$stderr.puts("Zombifying #{context.source_path}")
|
|
74
|
-
Loader::Eval.
|
|
75
|
+
Loader::Eval.call(zombified_root, self)
|
|
75
76
|
self
|
|
76
77
|
end
|
|
77
78
|
memoize :zombify
|