mutant 0.1.1 → 0.2.0
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.
- data/.gitignore +5 -11
- data/.rspec +0 -1
- data/.travis.yml +14 -3
- data/Changelog.md +3 -0
- data/Gemfile +5 -1
- data/Gemfile.devtools +49 -0
- data/Guardfile +18 -0
- data/README.md +67 -0
- data/Rakefile +4 -1
- data/TODO +13 -0
- data/bin/mutant +14 -0
- data/bin/zombie +14 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/roodi.yml +26 -0
- data/config/site.reek +93 -0
- data/config/yardstick.yml +2 -0
- data/lib/inflector.rb +7 -0
- data/lib/inflector/defaults.rb +62 -0
- data/lib/inflector/inflections.rb +209 -0
- data/lib/inflector/methods.rb +149 -0
- data/lib/inflector/version.rb +3 -0
- data/lib/mutant.rb +96 -21
- data/lib/mutant/cli.rb +309 -0
- data/lib/mutant/color.rb +61 -0
- data/lib/mutant/context.rb +36 -0
- data/lib/mutant/context/scope.rb +138 -0
- data/lib/mutant/differ.rb +100 -0
- data/lib/mutant/helper.rb +38 -0
- data/lib/mutant/killer.rb +136 -0
- data/lib/mutant/killer/forking.rb +41 -0
- data/lib/mutant/killer/rspec.rb +49 -0
- data/lib/mutant/killer/static.rb +19 -0
- data/lib/mutant/loader.rb +129 -0
- data/lib/mutant/matcher.rb +55 -0
- data/lib/mutant/matcher/chain.rb +66 -0
- data/lib/mutant/matcher/method.rb +173 -0
- data/lib/mutant/matcher/method/classifier.rb +126 -0
- data/lib/mutant/matcher/method/instance.rb +67 -0
- data/lib/mutant/matcher/method/singleton.rb +141 -0
- data/lib/mutant/matcher/object_space.rb +114 -0
- data/lib/mutant/matcher/scope_methods.rb +127 -0
- data/lib/mutant/mutation.rb +101 -12
- data/lib/mutant/mutation/filter.rb +75 -0
- data/lib/mutant/mutation/filter/code.rb +68 -0
- data/lib/mutant/mutation/filter/regexp.rb +39 -0
- data/lib/mutant/mutation/filter/whitelist.rb +47 -0
- data/lib/mutant/mutator.rb +134 -30
- data/lib/mutant/mutator/node.rb +163 -0
- data/lib/mutant/mutator/node/arguments.rb +24 -0
- data/lib/mutant/mutator/node/block.rb +24 -0
- data/lib/mutant/mutator/node/define.rb +24 -0
- data/lib/mutant/mutator/node/if_statement.rb +93 -0
- data/lib/mutant/mutator/node/literal.rb +54 -0
- data/lib/mutant/mutator/node/literal/array.rb +28 -0
- data/lib/mutant/mutator/node/literal/boolean.rb +49 -0
- data/lib/mutant/mutator/node/literal/dynamic.rb +24 -0
- data/lib/mutant/mutator/node/literal/empty_array.rb +26 -0
- data/lib/mutant/mutator/node/literal/fixnum.rb +37 -0
- data/lib/mutant/mutator/node/literal/float.rb +48 -0
- data/lib/mutant/mutator/node/literal/hash.rb +89 -0
- data/lib/mutant/mutator/node/literal/nil.rb +25 -0
- data/lib/mutant/mutator/node/literal/range.rb +94 -0
- data/lib/mutant/mutator/node/literal/regex.rb +43 -0
- data/lib/mutant/mutator/node/literal/string.rb +26 -0
- data/lib/mutant/mutator/node/literal/symbol.rb +26 -0
- data/lib/mutant/mutator/node/noop.rb +55 -0
- data/lib/mutant/mutator/node/receiver_case.rb +140 -0
- data/lib/mutant/mutator/node/return.rb +31 -0
- data/lib/mutant/mutator/node/send.rb +112 -0
- data/lib/mutant/mutator/registry.rb +48 -0
- data/lib/mutant/mutator/util.rb +87 -0
- data/lib/mutant/random.rb +24 -27
- data/lib/mutant/reporter.rb +48 -30
- data/lib/mutant/reporter/cli.rb +221 -0
- data/lib/mutant/reporter/null.rb +42 -0
- data/lib/mutant/reporter/stats.rb +64 -0
- data/lib/mutant/runner.rb +112 -0
- data/lib/mutant/strategy.rb +42 -0
- data/lib/mutant/strategy/rspec.rb +59 -0
- data/lib/mutant/strategy/rspec/example_lookup.rb +122 -0
- data/lib/mutant/subject.rb +115 -0
- data/lib/mutant/support/method_object.rb +31 -0
- data/locator.rb +87 -0
- data/mutant.gemspec +21 -21
- data/spec/integration/mutant/differ_spec.rb +15 -0
- data/spec/integration/mutant/loader_spec.rb +21 -0
- data/spec/integration/mutant/method_matching_spec.rb +269 -0
- data/spec/integration/mutant/rspec_killer_spec.rb +24 -0
- data/spec/integration/mutant/runner_spec.rb +26 -0
- data/spec/integration/mutant/zombie_spec.rb +8 -0
- data/spec/rcov.opts +7 -0
- data/spec/shared/command_method_behavior.rb +7 -0
- data/spec/shared/each_method_behaviour.rb +15 -0
- data/spec/shared/hash_method_behavior.rb +17 -0
- data/spec/shared/idempotent_method_behavior.rb +7 -0
- data/spec/shared/invertible_method_behaviour.rb +9 -0
- data/spec/shared/method_filter_parse_behavior.rb +16 -0
- data/spec/shared/method_match_behavior.rb +39 -0
- data/spec/shared/mutator_behavior.rb +46 -0
- data/spec/spec_helper.rb +11 -14
- data/spec/support/compress_helper.rb +10 -0
- data/spec/support/rspec.rb +22 -0
- data/spec/support/test_app.rb +5 -0
- data/spec/support/zombie.rb +141 -0
- data/spec/unit/mutant/cli/class_methods/new_spec.rb +87 -0
- data/spec/unit/mutant/cli/class_methods/run_spec.rb +38 -0
- data/spec/unit/mutant/context/root_spec.rb +11 -0
- data/spec/unit/mutant/context/scope/class_methods/build_spec.rb +29 -0
- data/spec/unit/mutant/context/scope/root_spec.rb +22 -0
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +27 -0
- data/spec/unit/mutant/killer/fail_ques_spec.rb +39 -0
- data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +32 -0
- data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +33 -0
- data/spec/unit/mutant/loader/rubinius/class_methods/run_spec.rb +42 -0
- data/spec/unit/mutant/matcher/chain/each_spec.rb +37 -0
- data/spec/unit/mutant/matcher/chain/matchers_spec.rb +12 -0
- data/spec/unit/mutant/matcher/class_methods/from_string_spec.rb +49 -0
- data/spec/unit/mutant/matcher/class_methods/parse_spec.rb +12 -0
- data/spec/unit/mutant/matcher/each_spec.rb +14 -0
- data/spec/unit/mutant/matcher/method/class_methods/parse_spec.rb +21 -0
- data/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb +34 -0
- data/spec/unit/mutant/matcher/method/method_spec.rb +11 -0
- data/spec/unit/mutant/matcher/object_space/class_methods/parse_spec.rb +24 -0
- data/spec/unit/mutant/matcher/object_space/each_spec.rb +31 -0
- data/spec/unit/mutant/mutator/each_spec.rb +25 -0
- data/spec/unit/mutant/mutator/emit_new_spec.rb +51 -0
- data/spec/unit/mutant/mutator/emit_spec.rb +52 -0
- data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +36 -0
- data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +47 -0
- data/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb +30 -0
- data/spec/unit/mutant/mutator/node/literal/array_spec.rb +30 -0
- data/spec/unit/mutant/mutator/node/literal/boolean/mutation_spec.rb +23 -0
- data/spec/unit/mutant/mutator/node/literal/empty_array_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +25 -0
- data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +34 -0
- data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +13 -0
- data/spec/unit/mutant/mutator/node/literal/range_spec.rb +35 -0
- data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +23 -0
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/receiver_case/mutation_spec.rb +27 -0
- data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +78 -0
- data/spec/unit/mutant/mutator/self_spec.rb +7 -0
- data/spec/unit/mutant/subject/class_methods/new_spec.rb +13 -0
- data/spec/unit/mutant/subject/context_spec.rb +14 -0
- data/spec/unit/mutant/subject/each_spec.rb +35 -0
- data/spec/unit/mutant/subject/node_spec.rb +13 -0
- data/tasks/metrics/ci.rake +7 -0
- data/tasks/metrics/flay.rake +41 -0
- data/tasks/metrics/flog.rake +43 -0
- data/tasks/metrics/heckle.rake +216 -0
- data/tasks/metrics/metric_fu.rake +31 -0
- data/tasks/metrics/reek.rake +15 -0
- data/tasks/metrics/roodi.rake +15 -0
- data/tasks/metrics/yardstick.rake +23 -0
- data/tasks/spec.rake +45 -0
- data/tasks/yard.rake +9 -0
- data/test_app/.rspec +1 -0
- data/test_app/lib/test_app.rb +5 -0
- data/test_app/lib/test_app/literal.rb +32 -0
- data/test_app/spec/shared/command_method_behavior.rb +7 -0
- data/test_app/spec/shared/each_method_behaviour.rb +15 -0
- data/test_app/spec/shared/hash_method_behavior.rb +17 -0
- data/test_app/spec/shared/idempotent_method_behavior.rb +7 -0
- data/test_app/spec/shared/invertible_method_behaviour.rb +9 -0
- data/test_app/spec/shared/method_filter_parse_behavior.rb +16 -0
- data/test_app/spec/shared/method_match_behavior.rb +39 -0
- data/test_app/spec/shared/mutator_behavior.rb +44 -0
- data/test_app/spec/spec_helper.rb +7 -0
- data/test_app/spec/unit/test_app/literal/command_spec.rb +9 -0
- data/test_app/spec/unit/test_app/literal/string_spec.rb +9 -0
- metadata +346 -124
- data/.rvmrc +0 -1
- data/Readme.md +0 -13
- data/exe/mutate +0 -6
- data/lib/mutant/extensions.rb +0 -8
- data/lib/mutant/formatter.rb +0 -19
- data/lib/mutant/implementation.rb +0 -70
- data/lib/mutant/literal.rb +0 -147
- data/lib/mutant/method.rb +0 -31
- data/lib/mutant/mutatee.rb +0 -61
- data/lib/mutant/node.rb +0 -26
- data/lib/mutant/runners/rspec.rb +0 -34
- data/lib/mutant/version.rb +0 -3
- data/spec/functional/class_spec.rb +0 -46
- data/spec/functional/instance_method/array_spec.rb +0 -53
- data/spec/functional/instance_method/boolean_spec.rb +0 -101
- data/spec/functional/instance_method/call_spec.rb +0 -161
- data/spec/functional/instance_method/fixnum_spec.rb +0 -53
- data/spec/functional/instance_method/float_spec.rb +0 -53
- data/spec/functional/instance_method/hash_spec.rb +0 -53
- data/spec/functional/instance_method/if_spec.rb +0 -57
- data/spec/functional/instance_method/ivar_assign_spec.rb +0 -62
- data/spec/functional/instance_method/range_spec.rb +0 -53
- data/spec/functional/instance_method/regex_spec.rb +0 -55
- data/spec/functional/instance_method/string_spec.rb +0 -53
- data/spec/functional/instance_method/symbol_spec.rb +0 -53
- data/spec/functional/reporter/method_loaded_spec.rb +0 -62
- data/spec/functional/reporter/running_mutations_spec.rb +0 -60
- data/spec/functional/runners/rspec_spec.rb +0 -26
- data/spec/functional/singleton_method/array_spec.rb +0 -53
- data/spec/functional/singleton_method/boolean_spec.rb +0 -101
- data/spec/functional/singleton_method/call_spec.rb +0 -161
- data/spec/functional/singleton_method/fixnum_spec.rb +0 -53
- data/spec/functional/singleton_method/float_spec.rb +0 -53
- data/spec/functional/singleton_method/hash_spec.rb +0 -53
- data/spec/functional/singleton_method/if_spec.rb +0 -57
- data/spec/functional/singleton_method/ivar_assign_spec.rb +0 -60
- data/spec/functional/singleton_method/range_spec.rb +0 -53
- data/spec/functional/singleton_method/regex_spec.rb +0 -55
- data/spec/functional/singleton_method/string_spec.rb +0 -53
- data/spec/functional/singleton_method/symbol_spec.rb +0 -53
- data/spec/mutant/extensions_spec.rb +0 -13
- data/spec/mutant/implementation_spec.rb +0 -223
- data/spec/mutant/literal_spec.rb +0 -129
- data/spec/mutant/mutatee_spec.rb +0 -28
- data/spec/mutant/node_spec.rb +0 -41
- data/spec/mutant/random_spec.rb +0 -33
- data/spec/mutant/reporter_spec.rb +0 -17
- data/spec/mutant_spec.rb +0 -28
- data/spec/support/example_group_helpers.rb +0 -11
- data/spec/support/example_helpers.rb +0 -5
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Mutating If clauses' do
|
|
4
|
-
context 'for an instance method' do
|
|
5
|
-
context 'that contains an if-else that returns 42' do
|
|
6
|
-
before do
|
|
7
|
-
write_file 'life.rb', """
|
|
8
|
-
class Life
|
|
9
|
-
def answer
|
|
10
|
-
if true
|
|
11
|
-
42
|
|
12
|
-
else
|
|
13
|
-
24
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
"""
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
context 'with an expectation that the answer is 42' do
|
|
21
|
-
before do
|
|
22
|
-
write_file 'spec/life_spec.rb', """
|
|
23
|
-
$: << '.'
|
|
24
|
-
require 'life'
|
|
25
|
-
|
|
26
|
-
describe 'Life#answer' do
|
|
27
|
-
specify { Life.new.answer.should eq(42) }
|
|
28
|
-
end
|
|
29
|
-
"""
|
|
30
|
-
run_simple '../../bin/mutate Life#answer spec/life_spec.rb'
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
specify 'the mutation passes' do
|
|
34
|
-
all_output.should include('passed')
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
context 'with an expectation that the answer is a Fixnum' do
|
|
39
|
-
before do
|
|
40
|
-
write_file 'spec/life_spec.rb', """
|
|
41
|
-
$: << '.'
|
|
42
|
-
require 'life'
|
|
43
|
-
|
|
44
|
-
describe 'Life#answer' do
|
|
45
|
-
specify { Life.new.answer.should be_kind_of(Fixnum) }
|
|
46
|
-
end
|
|
47
|
-
"""
|
|
48
|
-
run_simple '../../bin/mutate Life#answer spec/life_spec.rb'
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
specify 'the mutation fails' do
|
|
52
|
-
all_output.should include('failed')
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Mutating instance variable assignments' do
|
|
4
|
-
context 'for an instance method' do
|
|
5
|
-
context 'that contains @a = 1' do
|
|
6
|
-
before do
|
|
7
|
-
write_file 'thing.rb', """
|
|
8
|
-
class Thing
|
|
9
|
-
attr_reader :a
|
|
10
|
-
def set_a
|
|
11
|
-
@a = 1
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
"""
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
context 'with an expectation that a will be set to 1' do
|
|
18
|
-
before do
|
|
19
|
-
write_file 'spec/thing_spec.rb', """
|
|
20
|
-
$: << '.'
|
|
21
|
-
require 'thing'
|
|
22
|
-
|
|
23
|
-
describe 'Thing#set_a' do
|
|
24
|
-
specify do
|
|
25
|
-
thing = Thing.new
|
|
26
|
-
thing.set_a
|
|
27
|
-
thing.a.should eq(1)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
"""
|
|
31
|
-
mutate 'Thing#set_a spec/thing_spec.rb'
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
specify 'the mutation passes' do
|
|
35
|
-
all_output.should include('passed')
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
context 'with an expectation that a will bet set to some number' do
|
|
40
|
-
before do
|
|
41
|
-
write_file 'spec/thing_spec.rb', """
|
|
42
|
-
$: << '.'
|
|
43
|
-
require 'thing'
|
|
44
|
-
|
|
45
|
-
describe 'Thing#set_a' do
|
|
46
|
-
specify do
|
|
47
|
-
thing = Thing.new
|
|
48
|
-
thing.set_a
|
|
49
|
-
thing.a.should be_kind_of(Fixnum)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
"""
|
|
53
|
-
mutate 'Thing#set_a spec/thing_spec.rb'
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
specify 'the mutation fails' do
|
|
57
|
-
all_output.should include('failed')
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Mutating ranges' do
|
|
4
|
-
context 'for an instance method' do
|
|
5
|
-
context 'that contains a..z' do
|
|
6
|
-
before do
|
|
7
|
-
write_file 'thing.rb', """
|
|
8
|
-
class Thing
|
|
9
|
-
def a_range
|
|
10
|
-
'a'..'z'
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
"""
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context "with an expectation that the return value is `'a'..'z'`" do
|
|
17
|
-
before do
|
|
18
|
-
write_file 'spec/thing_spec.rb', """
|
|
19
|
-
$: << '.'
|
|
20
|
-
require 'thing'
|
|
21
|
-
|
|
22
|
-
describe 'Thing#a_range' do
|
|
23
|
-
specify { Thing.new.a_range.should eq('a'..'z') }
|
|
24
|
-
end
|
|
25
|
-
"""
|
|
26
|
-
mutate 'Thing#a_range spec/thing_spec.rb'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
specify 'the mutation passes' do
|
|
30
|
-
all_output.should include('passed')
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context "with an expectation that the return value is a range" do
|
|
35
|
-
before do
|
|
36
|
-
write_file 'spec/thing_spec.rb', """
|
|
37
|
-
$: << '.'
|
|
38
|
-
require 'thing'
|
|
39
|
-
|
|
40
|
-
describe 'Thing#a_range' do
|
|
41
|
-
specify { Thing.new.a_range.should be_a(Range) }
|
|
42
|
-
end
|
|
43
|
-
"""
|
|
44
|
-
mutate 'Thing#a_range spec/thing_spec.rb'
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
specify 'the mutation fails' do
|
|
48
|
-
all_output.should include('failed')
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Mutating regexen' do
|
|
4
|
-
context 'for an instance method' do
|
|
5
|
-
context 'that contains `.*`' do
|
|
6
|
-
before do
|
|
7
|
-
write_file 'thing.rb', """
|
|
8
|
-
class Thing
|
|
9
|
-
def regex
|
|
10
|
-
/.*/
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
"""
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context 'with an expectation that a string matches the regex' do
|
|
17
|
-
before do
|
|
18
|
-
write_file 'spec/thing_spec.rb', """
|
|
19
|
-
$: << '.'
|
|
20
|
-
require 'thing'
|
|
21
|
-
|
|
22
|
-
describe 'Thing#regex' do
|
|
23
|
-
specify do
|
|
24
|
-
'hello'.should match(Thing.new.regex)
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
"""
|
|
28
|
-
mutate 'Thing#regex spec/thing_spec.rb'
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
specify 'the mutation passes' do
|
|
32
|
-
all_output.should include('passed')
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
context 'with an expectation that the regex is a Regex' do
|
|
37
|
-
before do
|
|
38
|
-
write_file 'spec/thing_spec.rb', """
|
|
39
|
-
$: << '.'
|
|
40
|
-
require 'thing'
|
|
41
|
-
|
|
42
|
-
describe 'Thing#regex' do
|
|
43
|
-
specify { Thing.new.regex.should be_kind_of(Regexp) }
|
|
44
|
-
end
|
|
45
|
-
"""
|
|
46
|
-
mutate 'Thing#regex spec/thing_spec.rb'
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
specify 'the mutation fails' do
|
|
50
|
-
all_output.should include('failed')
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Mutating strings' do
|
|
4
|
-
context 'for an instance method' do
|
|
5
|
-
context 'that contains "foo"' do
|
|
6
|
-
before do
|
|
7
|
-
write_file 'thing.rb', """
|
|
8
|
-
class Thing
|
|
9
|
-
def a_string
|
|
10
|
-
'foo'
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
"""
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context 'with an expectation that the return value is "foo"' do
|
|
17
|
-
before do
|
|
18
|
-
write_file 'spec/thing_spec.rb', """
|
|
19
|
-
$: << '.'
|
|
20
|
-
require 'thing'
|
|
21
|
-
|
|
22
|
-
describe 'Thing#a_string' do
|
|
23
|
-
specify { Thing.new.a_string.should eq('foo') }
|
|
24
|
-
end
|
|
25
|
-
"""
|
|
26
|
-
mutate 'Thing#a_string spec/thing_spec.rb'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
specify 'the mutation passes' do
|
|
30
|
-
all_output.should include('passed')
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context 'with an expectation that the return value is a string' do
|
|
35
|
-
before do
|
|
36
|
-
write_file 'spec/thing_spec.rb', """
|
|
37
|
-
$: << '.'
|
|
38
|
-
require 'thing'
|
|
39
|
-
|
|
40
|
-
describe 'Thing#a_string' do
|
|
41
|
-
specify { Thing.new.a_string.should be_a(String) }
|
|
42
|
-
end
|
|
43
|
-
"""
|
|
44
|
-
mutate 'Thing#a_string spec/thing_spec.rb'
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
specify 'the mutation fails' do
|
|
48
|
-
all_output.should include('failed')
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Mutating symbols' do
|
|
4
|
-
context 'for an instance method' do
|
|
5
|
-
context 'that contains :foo' do
|
|
6
|
-
before do
|
|
7
|
-
write_file 'thing.rb', """
|
|
8
|
-
class Thing
|
|
9
|
-
def a_symbol
|
|
10
|
-
:foo
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
"""
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context 'with an expectation that the return value is :foo' do
|
|
17
|
-
before do
|
|
18
|
-
write_file 'spec/thing_spec.rb', """
|
|
19
|
-
$: << '.'
|
|
20
|
-
require 'thing'
|
|
21
|
-
|
|
22
|
-
describe 'Thing#a_symbol' do
|
|
23
|
-
specify { Thing.new.a_symbol.should eq(:foo) }
|
|
24
|
-
end
|
|
25
|
-
"""
|
|
26
|
-
mutate 'Thing#a_symbol spec/thing_spec.rb'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
specify 'the mutation passes' do
|
|
30
|
-
all_output.should include('passed')
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context 'with an expectation that the return value is a symbol' do
|
|
35
|
-
before do
|
|
36
|
-
write_file 'spec/thing_spec.rb', """
|
|
37
|
-
$: << '.'
|
|
38
|
-
require 'thing'
|
|
39
|
-
|
|
40
|
-
describe 'Thing#a_symbol' do
|
|
41
|
-
specify { Thing.new.a_symbol.should be_a(Symbol) }
|
|
42
|
-
end
|
|
43
|
-
"""
|
|
44
|
-
mutate 'Thing#a_symbol spec/thing_spec.rb'
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
specify 'the mutation fails' do
|
|
48
|
-
all_output.should include('failed')
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Reporter' do
|
|
4
|
-
describe 'method loaded' do
|
|
5
|
-
context 'that has mutations' do
|
|
6
|
-
before do
|
|
7
|
-
write_file 'thing.rb', """
|
|
8
|
-
class Thing
|
|
9
|
-
def alive?
|
|
10
|
-
true
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
"""
|
|
14
|
-
write_file 'spec/thing_spec.rb', """
|
|
15
|
-
$: << '.'
|
|
16
|
-
require 'thing'
|
|
17
|
-
|
|
18
|
-
describe 'Thing#alive?' do
|
|
19
|
-
specify { Thing.new.should be_alive }
|
|
20
|
-
end
|
|
21
|
-
"""
|
|
22
|
-
mutate 'Thing#alive? spec/thing_spec.rb'
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'displays the number of possible mutations' do
|
|
26
|
-
all_output.should include <<-STR
|
|
27
|
-
**********************************************************************
|
|
28
|
-
*** Thing#alive? loaded with 1 possible mutation
|
|
29
|
-
**********************************************************************
|
|
30
|
-
STR
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
context 'that has no mutations' do
|
|
35
|
-
before do
|
|
36
|
-
write_file 'thing.rb', """
|
|
37
|
-
class Thing
|
|
38
|
-
def alive?
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
"""
|
|
42
|
-
write_file 'spec/thing_spec.rb', """
|
|
43
|
-
$: << '.'
|
|
44
|
-
require 'thing'
|
|
45
|
-
|
|
46
|
-
describe 'Thing#alive?' do
|
|
47
|
-
specify { Thing.new.alive?.should be_nil }
|
|
48
|
-
end
|
|
49
|
-
"""
|
|
50
|
-
mutate 'Thing#alive? spec/thing_spec.rb'
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'displays a warning that there are no possible mutations' do
|
|
54
|
-
all_output.should include <<-STR
|
|
55
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
56
|
-
!!! Thing#alive? has no possible mutations
|
|
57
|
-
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
58
|
-
STR
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'Reporter' do
|
|
4
|
-
describe 'running mutations' do
|
|
5
|
-
before do
|
|
6
|
-
write_file 'thing.rb', <<-CODE
|
|
7
|
-
class Thing
|
|
8
|
-
def alive?
|
|
9
|
-
a_string = 'foo'
|
|
10
|
-
a_symbol = :bar
|
|
11
|
-
a_range = 'a'..'c'
|
|
12
|
-
:symbol
|
|
13
|
-
true
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
CODE
|
|
17
|
-
write_file 'spec/thing_spec.rb', """
|
|
18
|
-
$: << '.'
|
|
19
|
-
require 'thing'
|
|
20
|
-
|
|
21
|
-
describe 'Thing#alive?' do
|
|
22
|
-
specify { Thing.new.should be_alive }
|
|
23
|
-
end
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
ENV['RANDOM_STRING'] = 'bar'
|
|
27
|
-
ENV['RANDOM_SYMBOL'] = 'foo'
|
|
28
|
-
ENV['RANDOM_RANGE_MIN'] = '1'
|
|
29
|
-
ENV['RANDOM_RANGE_MAX'] = '3'
|
|
30
|
-
|
|
31
|
-
mutate 'Thing#alive? spec/thing_spec.rb'
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
after do
|
|
35
|
-
ENV['RANDOM_STRING'] = nil
|
|
36
|
-
ENV['RANDOM_SYMBOL'] = nil
|
|
37
|
-
ENV['RANDOM_RANGE_MIN'] = nil
|
|
38
|
-
ENV['RANDOM_RANGE_MAX'] = nil
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it 'displays the details of each mutation as they are run' do
|
|
42
|
-
all_output.should include <<-STR
|
|
43
|
-
Mutating line 3
|
|
44
|
-
a_string = "foo" >>> a_string = "bar"
|
|
45
|
-
|
|
46
|
-
Mutating line 4
|
|
47
|
-
a_symbol = :bar >>> a_symbol = :foo
|
|
48
|
-
|
|
49
|
-
Mutating line 5
|
|
50
|
-
a_range = "a".."c" >>> a_range = 1..3
|
|
51
|
-
|
|
52
|
-
Mutating line 6
|
|
53
|
-
:symbol >>> :foo
|
|
54
|
-
|
|
55
|
-
Mutating line 7
|
|
56
|
-
true >>> false
|
|
57
|
-
STR
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|