mutant 0.3.0.beta21 → 0.3.0.beta22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +37 -6
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.travis.yml +13 -7
- data/Gemfile +8 -3
- data/Gemfile.devtools +2 -6
- data/Guardfile +22 -8
- data/README.md +3 -1
- data/Rakefile +3 -0
- data/bin/mutant +4 -3
- data/config/devtools.yml +1 -1
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -1
- data/config/reek.yml +7 -6
- data/config/rubocop.yml +55 -0
- data/lib/mutant.rb +3 -1
- data/lib/mutant/cache.rb +2 -0
- data/lib/mutant/cli.rb +14 -10
- data/lib/mutant/cli/classifier.rb +22 -10
- data/lib/mutant/cli/classifier/method.rb +14 -15
- data/lib/mutant/cli/classifier/namespace.rb +6 -2
- data/lib/mutant/cli/classifier/scope.rb +3 -1
- data/lib/mutant/color.rb +7 -3
- data/lib/mutant/config.rb +2 -0
- data/lib/mutant/constants.rb +5 -4
- data/lib/mutant/context.rb +2 -0
- data/lib/mutant/context/scope.rb +3 -1
- data/lib/mutant/differ.rb +10 -2
- data/lib/mutant/killer.rb +4 -1
- data/lib/mutant/killer/forked.rb +2 -0
- data/lib/mutant/killer/forking.rb +2 -0
- data/lib/mutant/killer/rspec.rb +19 -3
- data/lib/mutant/killer/static.rb +2 -0
- data/lib/mutant/loader.rb +8 -1
- data/lib/mutant/matcher.rb +2 -0
- data/lib/mutant/matcher/chain.rb +2 -0
- data/lib/mutant/matcher/method.rb +15 -3
- data/lib/mutant/matcher/method/finder.rb +2 -0
- data/lib/mutant/matcher/method/instance.rb +4 -1
- data/lib/mutant/matcher/method/singleton.rb +7 -1
- data/lib/mutant/matcher/methods.rb +3 -1
- data/lib/mutant/matcher/namespace.rb +4 -2
- data/lib/mutant/matcher/scope.rb +2 -0
- data/lib/mutant/mutation.rb +19 -5
- data/lib/mutant/mutation/evil.rb +12 -0
- data/lib/mutant/mutation/filter.rb +2 -0
- data/lib/mutant/mutation/filter/code.rb +3 -1
- data/lib/mutant/mutation/filter/regexp.rb +2 -0
- data/lib/mutant/mutation/filter/whitelist.rb +2 -0
- data/lib/mutant/mutation/neutral.rb +25 -0
- data/lib/mutant/mutator.rb +4 -6
- data/lib/mutant/mutator/node.rb +5 -1
- data/lib/mutant/mutator/node/argument.rb +2 -0
- data/lib/mutant/mutator/node/arguments.rb +2 -0
- data/lib/mutant/mutator/node/begin.rb +2 -0
- data/lib/mutant/mutator/node/block.rb +2 -0
- data/lib/mutant/mutator/node/case.rb +3 -1
- data/lib/mutant/mutator/node/connective/binary.rb +3 -1
- data/lib/mutant/mutator/node/const.rb +2 -0
- data/lib/mutant/mutator/node/define.rb +2 -0
- data/lib/mutant/mutator/node/generic.rb +4 -3
- data/lib/mutant/mutator/node/if.rb +2 -0
- data/lib/mutant/mutator/node/literal.rb +2 -0
- data/lib/mutant/mutator/node/literal/array.rb +2 -0
- data/lib/mutant/mutator/node/literal/boolean.rb +2 -0
- data/lib/mutant/mutator/node/literal/dynamic.rb +2 -0
- data/lib/mutant/mutator/node/literal/fixnum.rb +3 -1
- data/lib/mutant/mutator/node/literal/float.rb +2 -0
- data/lib/mutant/mutator/node/literal/hash.rb +2 -0
- data/lib/mutant/mutator/node/literal/nil.rb +2 -0
- data/lib/mutant/mutator/node/literal/range.rb +2 -1
- data/lib/mutant/mutator/node/literal/regex.rb +2 -0
- data/lib/mutant/mutator/node/literal/string.rb +2 -0
- data/lib/mutant/mutator/node/literal/symbol.rb +5 -1
- data/lib/mutant/mutator/node/masgn.rb +2 -0
- data/lib/mutant/mutator/node/mlhs.rb +2 -0
- data/lib/mutant/mutator/node/named_value/access.rb +2 -0
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +2 -0
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +3 -1
- data/lib/mutant/mutator/node/{cbase.rb → noop.rb} +7 -5
- data/lib/mutant/mutator/node/return.rb +2 -0
- data/lib/mutant/mutator/node/send.rb +2 -0
- data/lib/mutant/mutator/node/send/binary.rb +2 -0
- data/lib/mutant/mutator/node/splat.rb +2 -0
- data/lib/mutant/mutator/node/super.rb +2 -0
- data/lib/mutant/mutator/node/when.rb +3 -1
- data/lib/mutant/mutator/node/while.rb +2 -0
- data/lib/mutant/mutator/node/zsuper.rb +2 -0
- data/lib/mutant/mutator/registry.rb +55 -13
- data/lib/mutant/mutator/util.rb +2 -0
- data/lib/mutant/mutator/util/array.rb +3 -1
- data/lib/mutant/mutator/util/symbol.rb +2 -0
- data/lib/mutant/node_helpers.rb +10 -4
- data/lib/mutant/random.rb +2 -0
- data/lib/mutant/reporter.rb +2 -0
- data/lib/mutant/reporter/cli.rb +2 -0
- data/lib/mutant/reporter/cli/printer.rb +2 -0
- data/lib/mutant/reporter/cli/printer/config.rb +5 -2
- data/lib/mutant/reporter/cli/printer/killer.rb +2 -0
- data/lib/mutant/reporter/cli/printer/mutation.rb +13 -6
- data/lib/mutant/reporter/cli/printer/subject.rb +5 -1
- data/lib/mutant/reporter/null.rb +2 -0
- data/lib/mutant/runner.rb +2 -0
- data/lib/mutant/runner/config.rb +2 -0
- data/lib/mutant/runner/mutation.rb +2 -0
- data/lib/mutant/runner/subject.rb +2 -0
- data/lib/mutant/singleton_methods.rb +5 -3
- data/lib/mutant/strategy.rb +2 -0
- data/lib/mutant/strategy/method_expansion.rb +2 -0
- data/lib/mutant/strategy/rspec.rb +2 -0
- data/lib/mutant/strategy/rspec/dm2.rb +2 -0
- data/lib/mutant/strategy/rspec/dm2/lookup.rb +4 -2
- data/lib/mutant/strategy/rspec/dm2/lookup/method.rb +2 -0
- data/lib/mutant/strategy/static.rb +2 -0
- data/lib/mutant/subject.rb +4 -1
- data/lib/mutant/subject/method.rb +2 -0
- data/lib/mutant/subject/method/instance.rb +2 -0
- data/lib/mutant/subject/method/singleton.rb +2 -0
- data/lib/mutant/support/method_object.rb +2 -0
- data/lib/mutant/zombifier.rb +10 -6
- data/mutant.gemspec +11 -10
- data/spec/integration/mutant/rspec_killer_spec.rb +9 -4
- data/spec/integration/mutant/test_mutator_handles_types_spec.rb +3 -1
- data/spec/integration/mutant/zombie_spec.rb +2 -0
- data/spec/shared/method_matcher_behavior.rb +2 -0
- data/spec/shared/mutator_behavior.rb +16 -7
- data/spec/spec_helper.rb +26 -5
- data/spec/support/compress_helper.rb +5 -5
- data/spec/support/ice_nine_config.rb +2 -0
- data/spec/support/rspec.rb +2 -0
- data/spec/support/test_app.rb +2 -0
- data/spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb +2 -0
- data/spec/unit/mutant/cli/class_methods/new_spec.rb +17 -8
- data/spec/unit/mutant/cli/class_methods/run_spec.rb +10 -2
- data/spec/unit/mutant/cli/classifier/class_methods/build_spec.rb +4 -1
- data/spec/unit/mutant/cli/classifier/method/each_spec.rb +89 -0
- data/spec/unit/mutant/cli/classifier/namespace/flat/each_spec.rb +58 -0
- data/spec/unit/mutant/cli/classifier/namespace/recursive/each_spec.rb +58 -0
- data/spec/unit/mutant/cli/classifier/scope/each_spec.rb +33 -0
- data/spec/unit/mutant/context/root_spec.rb +5 -1
- data/spec/unit/mutant/context/scope/root_spec.rb +2 -0
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +2 -0
- data/spec/unit/mutant/differ/class_methods/build_spec.rb +2 -0
- data/spec/unit/mutant/differ/class_methods/colorize_line_spec.rb +2 -0
- data/spec/unit/mutant/differ/diff_spec.rb +67 -5
- data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +21 -4
- data/spec/unit/mutant/killer/success_predicate_spec.rb +2 -0
- data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +12 -5
- data/spec/unit/mutant/matcher/chain/each_spec.rb +2 -0
- data/spec/unit/mutant/matcher/chain/matchers_spec.rb +2 -0
- data/spec/unit/mutant/matcher/each_spec.rb +8 -1
- data/spec/unit/mutant/matcher/method/instance/class_methods/build_spec.rb +4 -2
- data/spec/unit/mutant/matcher/method/instance/each_spec.rb +21 -20
- data/spec/unit/mutant/matcher/method/singleton/each_spec.rb +22 -19
- data/spec/unit/mutant/matcher/methods/instance/each_spec.rb +8 -3
- data/spec/unit/mutant/matcher/methods/singleton/each_spec.rb +8 -3
- data/spec/unit/mutant/matcher/namespace/each_spec.rb +8 -2
- data/spec/unit/mutant/mutator/each_spec.rb +2 -0
- data/spec/unit/mutant/mutator/emit_new_spec.rb +10 -3
- data/spec/unit/mutant/mutator/emit_spec.rb +4 -2
- data/spec/unit/mutant/mutator/node/and_asgn/mutation_spec.rb +26 -0
- data/spec/unit/mutant/mutator/node/begin/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +4 -2
- data/spec/unit/mutant/mutator/node/block_pass/mutation_spec.rb +14 -0
- data/spec/unit/mutant/mutator/node/break/mutation_spec.rb +15 -0
- data/spec/unit/mutant/mutator/node/case/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/cbase/mutation_spec.rb +3 -6
- data/spec/unit/mutant/mutator/node/connective/binary/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/const/mutation_spec.rb +3 -6
- data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +2 -1
- data/spec/unit/mutant/mutator/node/defined_predicate/mutation_spec.rb +10 -0
- data/spec/unit/mutant/mutator/node/dstr/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/dsym/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/ensure/mutation_spec.rb +15 -0
- data/spec/unit/mutant/mutator/node/if/mutation_spec.rb +2 -1
- data/spec/unit/mutant/mutator/node/literal/array_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/boolean/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +4 -2
- data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +4 -5
- data/spec/unit/mutant/mutator/node/literal/range_spec.rb +8 -8
- data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb +4 -10
- data/spec/unit/mutant/mutator/node/match_current_line/mutation_spec.rb +20 -0
- data/spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb +3 -2
- data/spec/unit/mutant/mutator/node/named_value/constant_assignment/mutation_spec.rb +3 -2
- data/spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb +3 -2
- data/spec/unit/mutant/mutator/node/next/mutation_spec.rb +15 -0
- data/spec/unit/mutant/mutator/node/op_assgn/mutation_spec.rb +26 -0
- data/spec/unit/mutant/mutator/node/or_asgn/mutation_spec.rb +26 -0
- data/spec/unit/mutant/mutator/node/redo/mutation_spec.rb +10 -0
- data/spec/unit/mutant/mutator/node/rescue/mutation_spec.rb +24 -0
- data/spec/unit/mutant/mutator/node/restarg/mutation_spec.rb +16 -0
- data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +3 -1
- data/spec/unit/mutant/mutator/node/super/mutation_spec.rb +2 -0
- data/spec/unit/mutant/mutator/node/while/mutation_spec.rb +3 -1
- data/spec/unit/mutant/mutator/node/yield/mutation_spec.rb +15 -0
- data/spec/unit/mutant/node_helpers/n_not_spec.rb +2 -0
- data/spec/unit/mutant/runner/config/subjects_spec.rb +6 -2
- data/spec/unit/mutant/runner/config/success_predicate_spec.rb +15 -6
- data/spec/unit/mutant/runner/mutation/killer_spec.rb +3 -1
- data/spec/unit/mutant/runner/subject/success_predicate_spec.rb +15 -8
- data/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb +2 -0
- data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb +32 -11
- data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb +31 -11
- data/spec/unit/mutant/subject/context_spec.rb +2 -0
- data/spec/unit/mutant/subject/mutations_spec.rb +2 -0
- data/spec/unit/mutant/subject/node_spec.rb +2 -0
- data/test_app/lib/test_app.rb +2 -0
- data/test_app/lib/test_app/literal.rb +2 -0
- data/test_app/spec/shared/method_filter_parse_behavior.rb +5 -1
- data/test_app/spec/shared/method_match_behavior.rb +2 -0
- data/test_app/spec/spec_helper.rb +3 -1
- data/test_app/spec/unit/test_app/literal/command_spec.rb +2 -0
- data/test_app/spec/unit/test_app/literal/string_spec.rb +3 -1
- metadata +66 -18
- data/bin/zombie +0 -18
- data/test_app/spec/shared/mutator_behavior.rb +0 -44
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator, 'block' do
|
@@ -21,7 +23,7 @@ describe Mutant::Mutator, 'block' do
|
|
21
23
|
let(:source) { 'foo { |a, b| }' }
|
22
24
|
|
23
25
|
before do
|
24
|
-
Mutant::Random.stub(:hex_string =>
|
26
|
+
Mutant::Random.stub(:hex_string => 'random')
|
25
27
|
end
|
26
28
|
|
27
29
|
let(:mutations) do
|
@@ -41,7 +43,7 @@ describe Mutant::Mutator, 'block' do
|
|
41
43
|
context 'with block pattern args' do
|
42
44
|
|
43
45
|
before do
|
44
|
-
Mutant::Random.stub(:hex_string =>
|
46
|
+
Mutant::Random.stub(:hex_string => 'random')
|
45
47
|
end
|
46
48
|
|
47
49
|
let(:source) { 'foo { |(a, b), c| }' }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::NamedValue::Access, 'block_pass' do
|
6
|
+
let(:source) { 'foo(&bar)' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutants = []
|
10
|
+
mutants << 'foo'
|
11
|
+
end
|
12
|
+
|
13
|
+
it_should_behave_like 'a mutator'
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'break' do
|
6
|
+
let(:source) { 'break true' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutations = []
|
10
|
+
mutations << 'break false'
|
11
|
+
mutations << 'break nil'
|
12
|
+
end
|
13
|
+
|
14
|
+
it_should_behave_like 'a mutator'
|
15
|
+
end
|
@@ -1,11 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Mutant::Mutator::Node::NamedValue::Access, 'cbase' do
|
1
|
+
# encoding: utf-8
|
4
2
|
|
5
|
-
|
6
|
-
Mutant::Random.stub(:hex_string => :random)
|
7
|
-
end
|
3
|
+
require 'spec_helper'
|
8
4
|
|
5
|
+
describe Mutant::Mutator::Node::Noop, 'cbase' do
|
9
6
|
let(:source) { '::A' }
|
10
7
|
|
11
8
|
let(:mutations) do
|
@@ -1,11 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Mutant::Mutator::Node::NamedValue::Access, 'const' do
|
1
|
+
# encoding: utf-8
|
4
2
|
|
5
|
-
|
6
|
-
Mutant::Random.stub(:hex_string => :random)
|
7
|
-
end
|
3
|
+
require 'spec_helper'
|
8
4
|
|
5
|
+
describe Mutant::Mutator::Node::Const, 'const' do
|
9
6
|
let(:source) { 'A::B' }
|
10
7
|
|
11
8
|
let(:mutations) do
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'dstr' do
|
6
|
+
before do
|
7
|
+
Mutant::Random.stub(:hex_string => 'random')
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:source) { '"foo#{bar}baz"' }
|
11
|
+
|
12
|
+
let(:mutations) do
|
13
|
+
mutations = []
|
14
|
+
mutations << '"random#{bar}baz"'
|
15
|
+
mutations << '"#{nil}#{bar}baz"'
|
16
|
+
mutations << '"foo#{bar}random"'
|
17
|
+
mutations << '"foo#{bar}#{nil}"'
|
18
|
+
end
|
19
|
+
|
20
|
+
it_should_behave_like 'a mutator'
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'dsum' do
|
6
|
+
before do
|
7
|
+
Mutant::Random.stub(:hex_string => 'random')
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:source) { ':"foo#{bar}baz"' }
|
11
|
+
|
12
|
+
let(:mutations) do
|
13
|
+
mutations = []
|
14
|
+
mutations << ':"random#{bar}baz"'
|
15
|
+
mutations << ':"#{nil}#{bar}baz"'
|
16
|
+
mutations << ':"foo#{bar}random"'
|
17
|
+
mutations << ':"foo#{bar}#{nil}"'
|
18
|
+
end
|
19
|
+
|
20
|
+
it_should_behave_like 'a mutator'
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'ensure' do
|
6
|
+
let(:source) { 'begin; rescue; ensure; true; end' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutations = []
|
10
|
+
mutations << 'begin; rescue; ensure; false; end'
|
11
|
+
mutations << 'begin; rescue; ensure; nil; end'
|
12
|
+
end
|
13
|
+
|
14
|
+
it_should_behave_like 'a mutator'
|
15
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator::Node::Literal, 'float' do
|
@@ -9,8 +11,8 @@ describe Mutant::Mutator::Node::Literal, 'float' do
|
|
9
11
|
mutations << '0.0'
|
10
12
|
mutations << '1.0'
|
11
13
|
mutations << random_float.to_s
|
12
|
-
mutations << '0.0/0.0'
|
13
|
-
mutations << '1.0/0.0'
|
14
|
+
mutations << '(0.0 / 0.0)'
|
15
|
+
mutations << '(1.0 / 0.0)'
|
14
16
|
mutations << '(-1.0 / 0.0)'
|
15
17
|
mutations << '-10.0'
|
16
18
|
end
|
@@ -1,11 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator::Node::Literal, 'nil' do
|
4
|
-
let(:source)
|
5
|
-
|
6
|
-
let(:mutations) do
|
7
|
-
[ '::Object.new' ]
|
8
|
-
end
|
6
|
+
let(:source) { 'nil' }
|
7
|
+
let(:mutations) { ['::Object.new'] }
|
9
8
|
|
10
9
|
it_should_behave_like 'a mutator'
|
11
10
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator::Node::Literal, 'range' do
|
@@ -8,10 +10,9 @@ describe Mutant::Mutator::Node::Literal, 'range' do
|
|
8
10
|
mutations = []
|
9
11
|
mutations << 'nil'
|
10
12
|
mutations << '1...100'
|
11
|
-
mutations << '(0.0/0.0)..100'
|
12
|
-
|
13
|
-
mutations << '1..(
|
14
|
-
mutations << '1..(0.0/0.0)'
|
13
|
+
mutations << '(0.0 / 0.0)..100'
|
14
|
+
mutations << '1..(1.0 / 0.0)'
|
15
|
+
mutations << '1..(0.0 / 0.0)'
|
15
16
|
end
|
16
17
|
|
17
18
|
it_should_behave_like 'a mutator'
|
@@ -24,10 +25,9 @@ describe Mutant::Mutator::Node::Literal, 'range' do
|
|
24
25
|
mutations = []
|
25
26
|
mutations << 'nil'
|
26
27
|
mutations << '1..100'
|
27
|
-
mutations << '(0.0/0.0)...100'
|
28
|
-
|
29
|
-
mutations << '1...(
|
30
|
-
mutations << '1...(0.0/0.0)'
|
28
|
+
mutations << '(0.0 / 0.0)...100'
|
29
|
+
mutations << '1...(1.0 / 0.0)'
|
30
|
+
mutations << '1...(0.0 / 0.0)'
|
31
31
|
end
|
32
32
|
|
33
33
|
it_should_behave_like 'a mutator'
|
@@ -1,16 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator, 'masgn' do
|
4
|
-
|
5
|
-
|
6
|
-
Mutant::Random.stub(:hex_string => 'random')
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:source) { 'a, b = c, d' }
|
10
|
-
|
11
|
-
let(:mutations) do
|
12
|
-
mutants = []
|
13
|
-
end
|
6
|
+
let(:source) { 'a, b = c, d' }
|
7
|
+
let(:mutations) { [] }
|
14
8
|
|
15
9
|
it_should_behave_like 'a mutator'
|
16
10
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'match_current_line' do
|
6
|
+
let(:source) { 'true if //' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutations = []
|
10
|
+
mutations << 'false if //'
|
11
|
+
mutations << 'nil if //'
|
12
|
+
mutations << 'true if true'
|
13
|
+
mutations << 'true if false'
|
14
|
+
mutations << 'true if nil'
|
15
|
+
mutations << 'true if !//'
|
16
|
+
mutations << 'true if /a\A/'
|
17
|
+
end
|
18
|
+
|
19
|
+
it_should_behave_like 'a mutator'
|
20
|
+
end
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
4
|
-
|
5
6
|
before do
|
6
|
-
Mutant::Random.stub(:hex_string =>
|
7
|
+
Mutant::Random.stub(:hex_string => 'random')
|
7
8
|
end
|
8
9
|
|
9
10
|
context 'global variable' do
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator::Node::NamedValue::VariableAssignment, 'mutations' do
|
4
|
-
|
5
6
|
before do
|
6
|
-
Mutant::Random.stub(:hex_string =>
|
7
|
+
Mutant::Random.stub(:hex_string => 'random')
|
7
8
|
end
|
8
9
|
|
9
10
|
let(:source) { 'A = true' }
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Mutant::Mutator::Node::NamedValue::VariableAssignment, 'mutations' do
|
4
|
-
|
5
6
|
before do
|
6
|
-
Mutant::Random.stub(:hex_string =>
|
7
|
+
Mutant::Random.stub(:hex_string => 'random')
|
7
8
|
end
|
8
9
|
|
9
10
|
context 'global variable' do
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'next' do
|
6
|
+
let(:source) { 'next true' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutations = []
|
10
|
+
mutations << 'next false'
|
11
|
+
mutations << 'next nil'
|
12
|
+
end
|
13
|
+
|
14
|
+
it_should_behave_like 'a mutator'
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Mutant::Mutator::Node::Generic, 'op_asgn' do
|
6
|
+
let(:random_fixnum) { 5 }
|
7
|
+
|
8
|
+
let(:source) { '@a.b += 1' }
|
9
|
+
|
10
|
+
let(:mutations) do
|
11
|
+
mutations = []
|
12
|
+
mutations << '@a.b += -1'
|
13
|
+
mutations << '@a.b += 2'
|
14
|
+
mutations << '@a.b += 0'
|
15
|
+
mutations << '@a.b += nil'
|
16
|
+
mutations << '@a += 1'
|
17
|
+
mutations << '@a.b += 5'
|
18
|
+
mutations << 'nil.b += 1'
|
19
|
+
end
|
20
|
+
|
21
|
+
before do
|
22
|
+
Mutant::Random.stub(:fixnum => random_fixnum)
|
23
|
+
end
|
24
|
+
|
25
|
+
it_should_behave_like 'a mutator'
|
26
|
+
end
|