mutant 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -2
- data/Changelog.md +7 -1
- data/lib/mutant/loader.rb +5 -3
- data/lib/mutant/mutation.rb +1 -1
- data/lib/mutant/subject.rb +20 -2
- data/mutant.gemspec +2 -2
- data/spec/support/zombie.rb +1 -1
- data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +10 -1
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +1 -1
- metadata +4 -7
- data/lib/mutant/inflector.rb +0 -10
- data/spec/integration/mutant/loader_spec.rb +0 -21
data/.travis.yml
CHANGED
data/Changelog.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
# v0.2.
|
1
|
+
# v0.2.6 2012-12-14
|
2
|
+
|
3
|
+
* [fixed] Correctly set file and line of injected mutants
|
4
|
+
|
5
|
+
[Compare v0.2.5..v0.2.6](https://github.com/mbj/mutant/compare/v0.2.5...v0.2.6)
|
6
|
+
|
7
|
+
# v0.2.5 2012-12-12
|
2
8
|
|
3
9
|
* [feature] Add --debug flag for showing killer output and mutation
|
4
10
|
* [feature] Run noop mutation per subject to guard against initial failing specs
|
data/lib/mutant/loader.rb
CHANGED
@@ -17,13 +17,15 @@ module Mutant
|
|
17
17
|
# Initialize and insert mutation into vm
|
18
18
|
#
|
19
19
|
# @param [Rubinius::AST::Script] root
|
20
|
+
# @param [String] file
|
21
|
+
# @param [Fixnum] line
|
20
22
|
#
|
21
23
|
# @return [undefined]
|
22
24
|
#
|
23
25
|
# @api private
|
24
26
|
#
|
25
|
-
def initialize(root)
|
26
|
-
@root =
|
27
|
+
def initialize(root, file, line)
|
28
|
+
@root, @file, @line = root, file, line
|
27
29
|
run
|
28
30
|
end
|
29
31
|
|
@@ -38,7 +40,7 @@ module Mutant
|
|
38
40
|
# @api private
|
39
41
|
#
|
40
42
|
def run
|
41
|
-
eval(source, TOPLEVEL_BINDING)
|
43
|
+
eval(source, TOPLEVEL_BINDING, @file, @line)
|
42
44
|
end
|
43
45
|
|
44
46
|
# Return source
|
data/lib/mutant/mutation.rb
CHANGED
data/lib/mutant/subject.rb
CHANGED
@@ -57,6 +57,26 @@ module Mutant
|
|
57
57
|
end
|
58
58
|
memoize :noop
|
59
59
|
|
60
|
+
# Return source path
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
#
|
64
|
+
# @api private
|
65
|
+
#
|
66
|
+
def source_path
|
67
|
+
context.source_path
|
68
|
+
end
|
69
|
+
|
70
|
+
# Return source line
|
71
|
+
#
|
72
|
+
# @return [Fixnum]
|
73
|
+
#
|
74
|
+
# @api private
|
75
|
+
#
|
76
|
+
def source_line
|
77
|
+
node.line
|
78
|
+
end
|
79
|
+
|
60
80
|
# Return subject identicication
|
61
81
|
#
|
62
82
|
# @return [String]
|
@@ -64,8 +84,6 @@ module Mutant
|
|
64
84
|
# @api private
|
65
85
|
#
|
66
86
|
def identification
|
67
|
-
source_path = context.source_path
|
68
|
-
source_line = node.line
|
69
87
|
"#{matcher.identification}:#{source_path}:#{source_line}"
|
70
88
|
end
|
71
89
|
memoize :identification
|
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.2.
|
5
|
+
gem.version = '0.2.6'
|
6
6
|
gem.authors = [ 'Markus Schirp' ]
|
7
7
|
gem.email = [ 'mbj@seonic.net' ]
|
8
8
|
gem.description = 'Mutation testing for ruby under rubinius'
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.extra_rdoc_files = %w[TODO]
|
16
16
|
gem.executables = [ 'mutant' ]
|
17
17
|
|
18
|
-
gem.add_runtime_dependency('to_source', '~> 0.2.
|
18
|
+
gem.add_runtime_dependency('to_source', '~> 0.2.5')
|
19
19
|
gem.add_runtime_dependency('ice_nine', '~> 0.5.0')
|
20
20
|
gem.add_runtime_dependency('descendants_tracker', '~> 0.0.1')
|
21
21
|
gem.add_runtime_dependency('backports', '~> 2.6')
|
data/spec/support/zombie.rb
CHANGED
@@ -2,9 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Mutant::Loader::Eval, '.run' do
|
4
4
|
|
5
|
-
subject { object.run(node) }
|
5
|
+
subject { object.run(node, file, line) }
|
6
6
|
|
7
7
|
let(:object) { described_class }
|
8
|
+
let(:file) { 'test.rb' }
|
9
|
+
let(:line) { 1 }
|
8
10
|
|
9
11
|
let(:source) do
|
10
12
|
# This test case will blow up when not executed
|
@@ -12,6 +14,8 @@ describe Mutant::Loader::Eval, '.run' do
|
|
12
14
|
<<-RUBY
|
13
15
|
class SomeNamespace
|
14
16
|
class Bar
|
17
|
+
def some_method
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
class SomeOther
|
@@ -30,4 +34,9 @@ describe Mutant::Loader::Eval, '.run' do
|
|
30
34
|
subject
|
31
35
|
::SomeNamespace::SomeOther::Foo
|
32
36
|
end
|
37
|
+
|
38
|
+
it 'should set file and line correctly' do
|
39
|
+
subject
|
40
|
+
::SomeNamespace::Bar.instance_method(:some_method).source_location.should eql(['test.rb', 3])
|
41
|
+
end
|
33
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: to_source
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.2.
|
21
|
+
version: 0.2.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.2.
|
29
|
+
version: 0.2.5
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: ice_nine
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,7 +188,6 @@ files:
|
|
188
188
|
- lib/mutant/context/scope.rb
|
189
189
|
- lib/mutant/differ.rb
|
190
190
|
- lib/mutant/helper.rb
|
191
|
-
- lib/mutant/inflector.rb
|
192
191
|
- lib/mutant/killer.rb
|
193
192
|
- lib/mutant/killer/forking.rb
|
194
193
|
- lib/mutant/killer/rspec.rb
|
@@ -247,7 +246,6 @@ files:
|
|
247
246
|
- lib/mutant/support/method_object.rb
|
248
247
|
- mutant.gemspec
|
249
248
|
- spec/integration/mutant/differ_spec.rb
|
250
|
-
- spec/integration/mutant/loader_spec.rb
|
251
249
|
- spec/integration/mutant/method_matching_spec.rb
|
252
250
|
- spec/integration/mutant/rspec_killer_spec.rb
|
253
251
|
- spec/integration/mutant/runner_spec.rb
|
@@ -359,7 +357,6 @@ specification_version: 3
|
|
359
357
|
summary: Mutation testing for ruby under rubinius
|
360
358
|
test_files:
|
361
359
|
- spec/integration/mutant/differ_spec.rb
|
362
|
-
- spec/integration/mutant/loader_spec.rb
|
363
360
|
- spec/integration/mutant/method_matching_spec.rb
|
364
361
|
- spec/integration/mutant/rspec_killer_spec.rb
|
365
362
|
- spec/integration/mutant/runner_spec.rb
|
data/lib/mutant/inflector.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class CodeLoadingSubject
|
4
|
-
def x
|
5
|
-
true
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
describe Mutant, 'code loading' do
|
10
|
-
let(:context) { Mutant::Context::Scope.new(CodeLoadingSubject, "/some/path") }
|
11
|
-
let(:node) { 'def foo; :bar; end'.to_ast }
|
12
|
-
let(:root) { context.root(node) }
|
13
|
-
|
14
|
-
subject { Mutant::Loader::Eval.run(root) }
|
15
|
-
|
16
|
-
before { subject }
|
17
|
-
|
18
|
-
it 'should add the method to subject' do
|
19
|
-
CodeLoadingSubject.new.foo.should be(:bar)
|
20
|
-
end
|
21
|
-
end
|