mutant 0.3.0.beta7 → 0.3.0.beta8
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/Rakefile +8 -0
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +0 -1
- data/lib/mutant/differ.rb +28 -31
- data/lib/mutant/mutator.rb +1 -1
- data/lib/mutant/mutator/node/block.rb +1 -2
- data/lib/mutant/mutator/node/define.rb +2 -5
- data/lib/mutant/node_helpers.rb +2 -0
- data/lib/mutant/reporter/cli/printer/mutation.rb +1 -1
- data/mutant.gemspec +3 -3
- data/spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb +39 -0
- data/spec/unit/mutant/differ/class_methods/build_spec.rb +12 -0
- data/spec/unit/mutant/differ/class_methods/colorize_line_spec.rb +22 -0
- data/spec/unit/mutant/differ/diff_spec.rb +61 -0
- data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +3 -2
- data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +15 -11
- data/spec/unit/mutant/mutator/node/noop/mutation_spec.rb +13 -0
- metadata +17 -12
- data/lib/mutant/helper.rb +0 -23
- data/spec/integration/mutant/differ_spec.rb +0 -15
- data/spec/integration/mutant/runner_spec.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 360fa704d17fde6a8699cf73cb30cfb1fe421e05
|
4
|
+
data.tar.gz: 9dbd9a5918ce529871b86fd5a80f1067f49da439
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1139b749e2e1e7a94060d8638113373681e9fafc8707b7b24d919ca9f41ab72e9d82c29fe4d44d7a3a5af32e6c7f7d1210096e14fec0df2803060901aa67b63
|
7
|
+
data.tar.gz: 40cfbe6e7022486af8d50ff8bbb943bc5946e0ed6402aa46a339a3fbd15f1317c760677365d8270b24c4744d96bbbc43a00fcb50d2083c2884fef5a22ba8a7f9
|
data/Rakefile
CHANGED
data/config/flay.yml
CHANGED
data/lib/mutant.rb
CHANGED
data/lib/mutant/differ.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
module Mutant
|
2
2
|
# Class to create diffs from source code
|
3
3
|
class Differ
|
4
|
-
include Adamantium::Flat
|
5
|
-
|
6
|
-
FORMAT = :unified
|
7
|
-
CONTEXT_LINES = 3
|
4
|
+
include Adamantium::Flat, Concord.new(:old, :new)
|
8
5
|
|
9
6
|
# Return source diff
|
10
7
|
#
|
@@ -14,12 +11,15 @@ module Mutant
|
|
14
11
|
#
|
15
12
|
def diff
|
16
13
|
output = ''
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
case diffs.length
|
15
|
+
when 0
|
16
|
+
nil
|
17
|
+
when 1
|
18
|
+
output = Diff::LCS::Hunk.new(old, new, diffs.first, max_length, 0).diff(:unified)
|
20
19
|
output << "\n"
|
20
|
+
else
|
21
|
+
raise 'Mutation resulted in more than one diff, should not happen!'
|
21
22
|
end
|
22
|
-
output
|
23
23
|
end
|
24
24
|
memoize :diff
|
25
25
|
|
@@ -36,23 +36,20 @@ module Mutant
|
|
36
36
|
end
|
37
37
|
memoize :colorized_diff
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
# Initialize differ object
|
39
|
+
# Return new object
|
42
40
|
#
|
43
41
|
# @param [String] old
|
44
42
|
# @param [String] new
|
45
43
|
#
|
46
|
-
# @return [
|
44
|
+
# @return [Differ]
|
47
45
|
#
|
48
46
|
# @api private
|
49
47
|
#
|
50
|
-
def
|
51
|
-
|
52
|
-
@diffs = Diff::LCS.diff(@old, @new)
|
48
|
+
def self.build(old, new)
|
49
|
+
new(lines(old), lines(new))
|
53
50
|
end
|
54
51
|
|
55
|
-
# Break up
|
52
|
+
# Break up source into lines
|
56
53
|
#
|
57
54
|
# @param [String] source
|
58
55
|
#
|
@@ -60,30 +57,32 @@ module Mutant
|
|
60
57
|
#
|
61
58
|
# @api private
|
62
59
|
#
|
63
|
-
def lines(source)
|
64
|
-
|
60
|
+
def self.lines(source)
|
61
|
+
source.lines.map { |line| line.chomp }
|
65
62
|
end
|
63
|
+
private_class_method :lines
|
64
|
+
|
65
|
+
private
|
66
66
|
|
67
|
-
# Return
|
67
|
+
# Return diffs
|
68
68
|
#
|
69
|
-
# @return [
|
69
|
+
# @return [Array<Array>]
|
70
70
|
#
|
71
71
|
# @api private
|
72
72
|
#
|
73
|
-
def
|
74
|
-
|
73
|
+
def diffs
|
74
|
+
Diff::LCS.diff(old, new)
|
75
75
|
end
|
76
|
+
memoize :diffs
|
76
77
|
|
77
|
-
#
|
78
|
-
#
|
79
|
-
# @param [String] source
|
78
|
+
# Return max length
|
80
79
|
#
|
81
|
-
# @return [
|
80
|
+
# @return [Fixnum]
|
82
81
|
#
|
83
82
|
# @api private
|
84
83
|
#
|
85
|
-
def
|
86
|
-
|
84
|
+
def max_length
|
85
|
+
old.length > new.length ? old.length : new.length
|
87
86
|
end
|
88
87
|
|
89
88
|
# Return colorized diff line
|
@@ -96,13 +95,11 @@ module Mutant
|
|
96
95
|
# @api private
|
97
96
|
#
|
98
97
|
def self.colorize_line(line)
|
99
|
-
case line[0]
|
98
|
+
case line[0]
|
100
99
|
when '+'
|
101
100
|
Color::GREEN
|
102
101
|
when '-'
|
103
102
|
Color::RED
|
104
|
-
when '@'
|
105
|
-
line[1].chr == '@' ? Color::BLUE : Color::NONE
|
106
103
|
else
|
107
104
|
Color::NONE
|
108
105
|
end.format(line)
|
data/lib/mutant/mutator.rb
CHANGED
data/lib/mutant/node_helpers.rb
CHANGED
@@ -38,7 +38,7 @@ module Mutant
|
|
38
38
|
#
|
39
39
|
def colorized_diff
|
40
40
|
original, current = mutation.original_source, mutation.source
|
41
|
-
differ = Differ.
|
41
|
+
differ = Differ.build(original, current)
|
42
42
|
diff = color? ? differ.colorized_diff : differ.diff
|
43
43
|
|
44
44
|
if diff.empty?
|
data/mutant.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'mutant'
|
5
|
-
gem.version = '0.3.0.
|
5
|
+
gem.version = '0.3.0.beta8'
|
6
6
|
gem.authors = [ 'Markus Schirp' ]
|
7
7
|
gem.email = [ 'mbj@schirp-dso.com' ]
|
8
8
|
|
@@ -16,8 +16,8 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.extra_rdoc_files = %w[TODO LICENSE]
|
17
17
|
gem.executables = [ 'mutant', 'zombie' ]
|
18
18
|
|
19
|
-
gem.add_runtime_dependency('parser', '~> 2.0.
|
20
|
-
gem.add_runtime_dependency('unparser', '~> 0.0.
|
19
|
+
gem.add_runtime_dependency('parser', '~> 2.0.beta10')
|
20
|
+
gem.add_runtime_dependency('unparser', '~> 0.0.7')
|
21
21
|
gem.add_runtime_dependency('ice_nine', '~> 0.8.0')
|
22
22
|
gem.add_runtime_dependency('descendants_tracker', '~> 0.0.1')
|
23
23
|
gem.add_runtime_dependency('adamantium', '~> 0.0.8')
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mutant, '.singleton_subclass_instance' do
|
4
|
+
let(:object) { described_class }
|
5
|
+
|
6
|
+
subject { object.singleton_subclass_instance(name, superclass, &block) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
subject
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:name) { 'Test' }
|
13
|
+
let(:block) { proc { def foo; end } }
|
14
|
+
let(:superclass) { Class.new }
|
15
|
+
|
16
|
+
let(:generated) { superclass.const_get(:Test) }
|
17
|
+
|
18
|
+
it_should_behave_like 'a command method'
|
19
|
+
|
20
|
+
it 'sets expected name' do
|
21
|
+
name = generated.class.name
|
22
|
+
name.should eql("::#{self.name}")
|
23
|
+
name.should be_frozen
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'stores instance of subclass' do
|
27
|
+
generated.should be_kind_of(superclass)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'evaluates the context of proc inside subclass' do
|
31
|
+
generated.should respond_to(:foo)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'generates nice #inspect' do
|
35
|
+
inspect = generated.inspect
|
36
|
+
inspect.should eql("::#{self.name}")
|
37
|
+
inspect.should be_frozen
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mutant::Differ, '.build' do
|
4
|
+
let(:object) { described_class }
|
5
|
+
|
6
|
+
subject { object.build(old_string, new_string) }
|
7
|
+
|
8
|
+
let(:old_string) { "foo\nbar" }
|
9
|
+
let(:new_string) { "bar\nbaz" }
|
10
|
+
|
11
|
+
it { should eql(Mutant::Differ.new(%w(foo bar), %w(bar baz))) }
|
12
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mutant::Differ, '.colorize_line' do
|
4
|
+
let(:object) { described_class }
|
5
|
+
|
6
|
+
subject { object.colorize_line(line) }
|
7
|
+
|
8
|
+
context 'line beginning with "+"' do
|
9
|
+
let(:line) { '+line' }
|
10
|
+
it { should eql(Mutant::Color::GREEN.format(line)) }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'line beginning with "-"' do
|
14
|
+
let(:line) { '-line' }
|
15
|
+
it { should eql(Mutant::Color::RED.format(line)) }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'line beginning in other char' do
|
19
|
+
let(:line) { ' line' }
|
20
|
+
it { should eql(line) }
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mutant::Differ, '#diff' do
|
4
|
+
let(:object) { described_class.new(old, new) }
|
5
|
+
|
6
|
+
subject { object.diff }
|
7
|
+
|
8
|
+
context 'when there is a diff at begin of hunk' do
|
9
|
+
let(:old) { %w(foo bar) }
|
10
|
+
let(:new) { %w(baz bar) }
|
11
|
+
|
12
|
+
it { should eql("@@ -1,3 +1,3 @@\n-foo\n+baz\n bar\n") }
|
13
|
+
|
14
|
+
it_should_behave_like 'an idempotent method'
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'when there is a diff NOT at begin of hunk' do
|
18
|
+
let(:old) { %w(foo bar) }
|
19
|
+
let(:new) { %w(foo baz bar) }
|
20
|
+
|
21
|
+
it { should eql("@@ -1,3 +1,4 @@\n foo\n+baz\n bar\n") }
|
22
|
+
|
23
|
+
it_should_behave_like 'an idempotent method'
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when the diff has a long context at begin' do
|
27
|
+
let(:old) { %w(foo bar baz boz a b c) }
|
28
|
+
let(:new) { %w(foo bar baz boz a b c other) }
|
29
|
+
|
30
|
+
it { should eql("@@ -1,8 +1,9 @@\n foo\n bar\n baz\n boz\n a\n b\n c\n+other\n") }
|
31
|
+
|
32
|
+
it_should_behave_like 'an idempotent method'
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when the diff has a long context at end, deleting' do
|
36
|
+
let(:old) { %w(other foo bar baz boz a b c) }
|
37
|
+
let(:new) { %w(foo bar baz boz a b c) }
|
38
|
+
|
39
|
+
it { should eql("@@ -1,9 +1,8 @@\n-other\n foo\n bar\n baz\n boz\n a\n b\n c\n") }
|
40
|
+
|
41
|
+
it_should_behave_like 'an idempotent method'
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when the diff has a long context at end, inserting' do
|
45
|
+
let(:old) { %w(foo bar baz boz a b c) }
|
46
|
+
let(:new) { %w(other foo bar baz boz a b c) }
|
47
|
+
|
48
|
+
it { should eql("@@ -1,8 +1,9 @@\n+other\n foo\n bar\n baz\n boz\n a\n b\n c\n") }
|
49
|
+
|
50
|
+
it_should_behave_like 'an idempotent method'
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when there is no diff' do
|
54
|
+
let(:old) { '' }
|
55
|
+
let(:new) { '' }
|
56
|
+
|
57
|
+
it { should be(nil) }
|
58
|
+
|
59
|
+
it_should_behave_like 'an idempotent method'
|
60
|
+
end
|
61
|
+
end
|
@@ -9,6 +9,7 @@ describe Mutant::Mutator, 'block' do
|
|
9
9
|
mutations << 'foo { a }'
|
10
10
|
mutations << 'foo { b }'
|
11
11
|
mutations << 'foo {}'
|
12
|
+
mutations << 'foo { raise }'
|
12
13
|
mutations << 'foo'
|
13
14
|
end
|
14
15
|
|
@@ -26,7 +27,7 @@ describe Mutant::Mutator, 'block' do
|
|
26
27
|
let(:mutations) do
|
27
28
|
mutations = []
|
28
29
|
mutations << 'foo'
|
29
|
-
mutations << 'foo { |a, b|
|
30
|
+
mutations << 'foo { |a, b| raise }'
|
30
31
|
mutations << 'foo { |a, srandom| }'
|
31
32
|
mutations << 'foo { |srandom, b| }'
|
32
33
|
mutations << 'foo { |a| }'
|
@@ -49,7 +50,7 @@ describe Mutant::Mutator, 'block' do
|
|
49
50
|
mutations = []
|
50
51
|
mutations << 'foo { || }'
|
51
52
|
mutations << 'foo { |a, b, c| }'
|
52
|
-
mutations << 'foo { |(a, b), c|
|
53
|
+
mutations << 'foo { |(a, b), c| raise }'
|
53
54
|
mutations << 'foo { |(a), c| }'
|
54
55
|
mutations << 'foo { |(b), c| }'
|
55
56
|
mutations << 'foo { |(a, b)| }'
|
@@ -7,7 +7,7 @@ describe Mutant::Mutator, 'def' do
|
|
7
7
|
|
8
8
|
let(:mutations) do
|
9
9
|
mutations = []
|
10
|
-
mutations << 'def foo;
|
10
|
+
mutations << 'def foo; raise; end'
|
11
11
|
end
|
12
12
|
|
13
13
|
it_should_behave_like 'a mutator'
|
@@ -31,6 +31,8 @@ describe Mutant::Mutator, 'def' do
|
|
31
31
|
|
32
32
|
# Remove all statements
|
33
33
|
mutations << 'def foo; end'
|
34
|
+
|
35
|
+
mutations << 'def foo; raise; end'
|
34
36
|
end
|
35
37
|
|
36
38
|
it_should_behave_like 'a mutator'
|
@@ -58,7 +60,7 @@ describe Mutant::Mutator, 'def' do
|
|
58
60
|
mutations << 'def foo(a, srandom); end'
|
59
61
|
|
60
62
|
# Mutation of body
|
61
|
-
mutations << 'def foo(a, b);
|
63
|
+
mutations << 'def foo(a, b); raise; end'
|
62
64
|
end
|
63
65
|
|
64
66
|
it_should_behave_like 'a mutator'
|
@@ -69,7 +71,7 @@ describe Mutant::Mutator, 'def' do
|
|
69
71
|
|
70
72
|
let(:mutations) do
|
71
73
|
mutations = []
|
72
|
-
mutations << 'def foo(_unused);
|
74
|
+
mutations << 'def foo(_unused); raise; end'
|
73
75
|
mutations << 'def foo; end'
|
74
76
|
end
|
75
77
|
|
@@ -90,7 +92,7 @@ describe Mutant::Mutator, 'def' do
|
|
90
92
|
mutations << 'def foo(a = false); end'
|
91
93
|
mutations << 'def foo(a = nil); end'
|
92
94
|
mutations << 'def foo(srandom = true); end'
|
93
|
-
mutations << 'def foo(a = true);
|
95
|
+
mutations << 'def foo(a = true); raise; end'
|
94
96
|
end
|
95
97
|
|
96
98
|
it_should_behave_like 'a mutator'
|
@@ -114,6 +116,8 @@ describe Mutant::Mutator, 'def' do
|
|
114
116
|
|
115
117
|
# Remove all statements
|
116
118
|
mutations << 'def self.foo; end'
|
119
|
+
|
120
|
+
mutations << 'def self.foo; raise; end'
|
117
121
|
end
|
118
122
|
|
119
123
|
it_should_behave_like 'a mutator'
|
@@ -125,24 +129,24 @@ describe Mutant::Mutator, 'def' do
|
|
125
129
|
Mutant::Random.stub(:hex_string => 'random')
|
126
130
|
end
|
127
131
|
|
128
|
-
let(:source) { 'def self.foo(a, b);
|
132
|
+
let(:source) { 'def self.foo(a, b); end' }
|
129
133
|
|
130
134
|
let(:mutations) do
|
131
135
|
mutations = []
|
132
136
|
|
133
137
|
# Deletion of each argument
|
134
|
-
mutations << 'def self.foo(a);
|
135
|
-
mutations << 'def self.foo(b);
|
138
|
+
mutations << 'def self.foo(a); end'
|
139
|
+
mutations << 'def self.foo(b); end'
|
136
140
|
|
137
141
|
# Deletion of all arguments
|
138
|
-
mutations << 'def self.foo;
|
142
|
+
mutations << 'def self.foo; end'
|
139
143
|
|
140
144
|
# Rename each argument
|
141
|
-
mutations << 'def self.foo(srandom, b);
|
142
|
-
mutations << 'def self.foo(a, srandom);
|
145
|
+
mutations << 'def self.foo(srandom, b); end'
|
146
|
+
mutations << 'def self.foo(a, srandom); end'
|
143
147
|
|
144
148
|
# Mutation of body
|
145
|
-
mutations << 'def self.foo(a, b);
|
149
|
+
mutations << 'def self.foo(a, b); raise; end'
|
146
150
|
end
|
147
151
|
|
148
152
|
it_should_behave_like 'a mutator'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# FIXME: This spec needs to be structured better!
|
4
|
+
describe Mutant::Mutator::Node::Noop, 'send' do
|
5
|
+
|
6
|
+
let(:source) { 'alias foo bar' }
|
7
|
+
|
8
|
+
let(:mutations) do
|
9
|
+
mutations = []
|
10
|
+
end
|
11
|
+
|
12
|
+
it_should_behave_like 'a mutator'
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.
|
4
|
+
version: 0.3.0.beta8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.
|
19
|
+
version: 2.0.beta10
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.
|
26
|
+
version: 2.0.beta10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: unparser
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.7
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ice_nine
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,7 +193,6 @@ files:
|
|
193
193
|
- lib/mutant/context.rb
|
194
194
|
- lib/mutant/context/scope.rb
|
195
195
|
- lib/mutant/differ.rb
|
196
|
-
- lib/mutant/helper.rb
|
197
196
|
- lib/mutant/killer.rb
|
198
197
|
- lib/mutant/killer/forked.rb
|
199
198
|
- lib/mutant/killer/forking.rb
|
@@ -277,9 +276,7 @@ files:
|
|
277
276
|
- lib/mutant/support/method_object.rb
|
278
277
|
- lib/mutant/zombifier.rb
|
279
278
|
- mutant.gemspec
|
280
|
-
- spec/integration/mutant/differ_spec.rb
|
281
279
|
- spec/integration/mutant/rspec_killer_spec.rb
|
282
|
-
- spec/integration/mutant/runner_spec.rb
|
283
280
|
- spec/integration/mutant/test_mutator_handles_types_spec.rb
|
284
281
|
- spec/integration/mutant/zombie_spec.rb
|
285
282
|
- spec/rcov.opts
|
@@ -290,12 +287,16 @@ files:
|
|
290
287
|
- spec/support/ice_nine_config.rb
|
291
288
|
- spec/support/rspec.rb
|
292
289
|
- spec/support/test_app.rb
|
290
|
+
- spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
|
293
291
|
- spec/unit/mutant/cli/class_methods/new_spec.rb
|
294
292
|
- spec/unit/mutant/cli/class_methods/run_spec.rb
|
295
293
|
- spec/unit/mutant/cli/classifier/class_methods/build_spec.rb
|
296
294
|
- spec/unit/mutant/context/root_spec.rb
|
297
295
|
- spec/unit/mutant/context/scope/root_spec.rb
|
298
296
|
- spec/unit/mutant/context/scope/unqualified_name_spec.rb
|
297
|
+
- spec/unit/mutant/differ/class_methods/build_spec.rb
|
298
|
+
- spec/unit/mutant/differ/class_methods/colorize_line_spec.rb
|
299
|
+
- spec/unit/mutant/differ/diff_spec.rb
|
299
300
|
- spec/unit/mutant/killer/rspec/class_methods/new_spec.rb
|
300
301
|
- spec/unit/mutant/killer/success_predicate_spec.rb
|
301
302
|
- spec/unit/mutant/loader/eval/class_methods/run_spec.rb
|
@@ -327,6 +328,7 @@ files:
|
|
327
328
|
- spec/unit/mutant/mutator/node/literal/regex_spec.rb
|
328
329
|
- spec/unit/mutant/mutator/node/literal/string_spec.rb
|
329
330
|
- spec/unit/mutant/mutator/node/literal/symbol_spec.rb
|
331
|
+
- spec/unit/mutant/mutator/node/noop/mutation_spec.rb
|
330
332
|
- spec/unit/mutant/mutator/node/return/mutation_spec.rb
|
331
333
|
- spec/unit/mutant/mutator/node/send/mutation_spec.rb
|
332
334
|
- spec/unit/mutant/mutator/node/super/mutation_spec.rb
|
@@ -376,14 +378,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
376
378
|
version: 1.3.1
|
377
379
|
requirements: []
|
378
380
|
rubyforge_project:
|
379
|
-
rubygems_version: 2.0.
|
381
|
+
rubygems_version: 2.0.3
|
380
382
|
signing_key:
|
381
383
|
specification_version: 4
|
382
384
|
summary: Mutation testing tool for ruby under MRI and Rubinius
|
383
385
|
test_files:
|
384
|
-
- spec/integration/mutant/differ_spec.rb
|
385
386
|
- spec/integration/mutant/rspec_killer_spec.rb
|
386
|
-
- spec/integration/mutant/runner_spec.rb
|
387
387
|
- spec/integration/mutant/test_mutator_handles_types_spec.rb
|
388
388
|
- spec/integration/mutant/zombie_spec.rb
|
389
389
|
- spec/rcov.opts
|
@@ -394,12 +394,16 @@ test_files:
|
|
394
394
|
- spec/support/ice_nine_config.rb
|
395
395
|
- spec/support/rspec.rb
|
396
396
|
- spec/support/test_app.rb
|
397
|
+
- spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
|
397
398
|
- spec/unit/mutant/cli/class_methods/new_spec.rb
|
398
399
|
- spec/unit/mutant/cli/class_methods/run_spec.rb
|
399
400
|
- spec/unit/mutant/cli/classifier/class_methods/build_spec.rb
|
400
401
|
- spec/unit/mutant/context/root_spec.rb
|
401
402
|
- spec/unit/mutant/context/scope/root_spec.rb
|
402
403
|
- spec/unit/mutant/context/scope/unqualified_name_spec.rb
|
404
|
+
- spec/unit/mutant/differ/class_methods/build_spec.rb
|
405
|
+
- spec/unit/mutant/differ/class_methods/colorize_line_spec.rb
|
406
|
+
- spec/unit/mutant/differ/diff_spec.rb
|
403
407
|
- spec/unit/mutant/killer/rspec/class_methods/new_spec.rb
|
404
408
|
- spec/unit/mutant/killer/success_predicate_spec.rb
|
405
409
|
- spec/unit/mutant/loader/eval/class_methods/run_spec.rb
|
@@ -431,6 +435,7 @@ test_files:
|
|
431
435
|
- spec/unit/mutant/mutator/node/literal/regex_spec.rb
|
432
436
|
- spec/unit/mutant/mutator/node/literal/string_spec.rb
|
433
437
|
- spec/unit/mutant/mutator/node/literal/symbol_spec.rb
|
438
|
+
- spec/unit/mutant/mutator/node/noop/mutation_spec.rb
|
434
439
|
- spec/unit/mutant/mutator/node/return/mutation_spec.rb
|
435
440
|
- spec/unit/mutant/mutator/node/send/mutation_spec.rb
|
436
441
|
- spec/unit/mutant/mutator/node/super/mutation_spec.rb
|
data/lib/mutant/helper.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module Mutant
|
2
|
-
# Module for support methods
|
3
|
-
#
|
4
|
-
# They would normally be defined on the root namespace.
|
5
|
-
# But it is easier to create the Zombie when there are no
|
6
|
-
# References to the root namespace name within the library.
|
7
|
-
#
|
8
|
-
module Helper
|
9
|
-
|
10
|
-
# Return deep clone of object
|
11
|
-
#
|
12
|
-
# @param [Object] object
|
13
|
-
#
|
14
|
-
# @return [Object] object
|
15
|
-
#
|
16
|
-
# @api private
|
17
|
-
#
|
18
|
-
def self.deep_clone(object)
|
19
|
-
Marshal.load(Marshal.dump(object))
|
20
|
-
end
|
21
|
-
|
22
|
-
end # Helper
|
23
|
-
end # Mutant
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant,'differ' do
|
4
|
-
specify 'allows to create diffs from text' do
|
5
|
-
a = "Foo\nBar\n"
|
6
|
-
b = "Foo\nBaz\n"
|
7
|
-
differ = Mutant::Differ.new(a,b)
|
8
|
-
differ.diff.should == strip_indent(<<-RUBY)
|
9
|
-
@@ -1,3 +1,3 @@
|
10
|
-
Foo
|
11
|
-
-Bar
|
12
|
-
+Baz
|
13
|
-
RUBY
|
14
|
-
end
|
15
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant, 'runner' do
|
4
|
-
before do
|
5
|
-
pending
|
6
|
-
end
|
7
|
-
|
8
|
-
around do |example|
|
9
|
-
Dir.chdir(TestApp.root) do
|
10
|
-
example.run
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'allows to run mutant over a project' do
|
15
|
-
output = StringIO.new
|
16
|
-
runner = Mutant::Runner.run(
|
17
|
-
:killer => Mutant::Killer::Rspec,
|
18
|
-
:matcher => Mutant::Matcher::ObjectSpace.new(/\ATestApp::/),
|
19
|
-
:reporter => Mutant::Reporter::CLI.new(output)
|
20
|
-
)
|
21
|
-
runner.fail?.should be(true)
|
22
|
-
runner.errors.size.should be(22)
|
23
|
-
output.rewind
|
24
|
-
output.lines.grep(/Mutant alive:/).size.should be(22)
|
25
|
-
end
|
26
|
-
end
|