mutant 0.5.16 → 0.5.17
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/.rubocop.yml +5 -5
- data/.travis.yml +2 -2
- data/Changelog.md +8 -0
- data/Gemfile.devtools +17 -21
- data/config/flay.yml +1 -1
- data/config/rubocop.yml +14 -1
- data/lib/mutant/cli.rb +2 -2
- data/lib/mutant/cli/classifier.rb +1 -1
- data/lib/mutant/constants.rb +9 -9
- data/lib/mutant/matcher/method.rb +1 -1
- data/lib/mutant/matcher/method/singleton.rb +1 -1
- data/lib/mutant/matcher/null.rb +1 -1
- data/lib/mutant/mutator/node/arguments.rb +1 -1
- data/lib/mutant/mutator/node/send.rb +1 -1
- data/lib/mutant/reporter/cli/printer.rb +2 -2
- data/lib/mutant/reporter/cli/progress.rb +2 -0
- data/lib/mutant/reporter/cli/progress/config.rb +8 -6
- data/lib/mutant/reporter/cli/progress/mutation.rb +5 -2
- data/lib/mutant/reporter/cli/progress/noop.rb +1 -1
- data/lib/mutant/reporter/cli/progress/subject.rb +12 -20
- data/lib/mutant/reporter/cli/report/config.rb +7 -7
- data/lib/mutant/runner.rb +14 -0
- data/lib/mutant/runner/config.rb +0 -1
- data/lib/mutant/runner/killer.rb +11 -0
- data/lib/mutant/runner/mutation.rb +10 -4
- data/lib/mutant/runner/subject.rb +0 -2
- data/lib/mutant/strategy.rb +0 -2
- data/lib/mutant/subject/method/instance.rb +0 -2
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/zombifier.rb +3 -3
- data/lib/mutant/zombifier/file.rb +1 -1
- data/mutant-rspec.gemspec +1 -1
- data/spec/integration/mutant/corpus_spec.rb +13 -8
- data/spec/integration/mutant/zombie_spec.rb +1 -1
- data/spec/unit/mutant/cli_new_spec.rb +10 -10
- data/spec/unit/mutant/diff_spec.rb +11 -11
- data/spec/unit/mutant/matcher/method/instance_spec.rb +4 -3
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +2 -1
- data/spec/unit/mutant/mutator/node/literal/boolean_spec.rb +2 -2
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +1 -1
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +1 -1
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +1 -1
- data/spec/unit/mutant/runner/mutation_spec.rb +19 -17
- data/test_app/Gemfile.devtools +17 -21
- data/test_app/lib/test_app/literal.rb +1 -1
- data/test_app/spec/unit/test_app/literal/command_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ed19319f31c14a3b2677f67cda130f8ae053af1
|
4
|
+
data.tar.gz: 6cb628e6e446ed9d1f0c14ad88cfd254d49ee216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 482eeee0d39d0e9b869b6a0625d71bf7b08bbdf8acff2fc9f29b44a9b74472cd038e166f053e17323dd41d46295f802245db69d7bb6dc7085336243bc448351b
|
7
|
+
data.tar.gz: f332afc9b4404fbcb8ee20e5e74fe6789df531c856d1fc4562d5cb92dee1d771d900405ba044f5360bad39f6400002786584da7f0f4c6efce0be2c5bd4ba5f64
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Changelog.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# v0.5.17 2014-05-27
|
2
|
+
|
3
|
+
Changes:
|
4
|
+
|
5
|
+
* Report selected tests in progress runner
|
6
|
+
* Fix scope of rspec selections to include meaningful parents.
|
7
|
+
* Add short circuts on already dead mutations under multiple test selections.
|
8
|
+
|
1
9
|
# v0.5.16 2014-05-27
|
2
10
|
|
3
11
|
Changes:
|
data/Gemfile.devtools
CHANGED
@@ -1,34 +1,30 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake', '~> 10.1
|
5
|
-
gem 'rspec', '~> 2.
|
6
|
-
gem 'rspec-core', '~> 2.
|
7
|
-
gem 'yard', '~> 0.8.7'
|
4
|
+
gem 'rake', '~> 10.3.1'
|
5
|
+
gem 'rspec', '~> 2.99.0.beta2'
|
6
|
+
gem 'rspec-core', '~> 2.99.0.beta2'
|
7
|
+
gem 'yard', '~> 0.8.7.4'
|
8
8
|
|
9
9
|
platform :rbx do
|
10
10
|
gem 'rubysl-singleton', '~> 2.0.0'
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
group :yard do
|
15
|
-
gem 'kramdown', '~> 1.3.2'
|
16
|
-
end
|
17
|
-
|
18
14
|
group :guard do
|
19
|
-
gem 'guard', '~> 2.
|
15
|
+
gem 'guard', '~> 2.6.0'
|
20
16
|
gem 'guard-bundler', '~> 2.0.0'
|
21
|
-
gem 'guard-rspec', '~> 4.2.
|
22
|
-
gem 'guard-rubocop', '~> 1.0
|
17
|
+
gem 'guard-rspec', '~> 4.2.8'
|
18
|
+
gem 'guard-rubocop', '~> 1.1.0'
|
23
19
|
|
24
20
|
# file system change event handling
|
25
|
-
gem 'listen', '~> 2.
|
21
|
+
gem 'listen', '~> 2.7.3'
|
26
22
|
gem 'rb-fchange', '~> 0.0.6', require: false
|
27
|
-
gem 'rb-fsevent', '~> 0.9.
|
28
|
-
gem 'rb-inotify', '~> 0.9.
|
23
|
+
gem 'rb-fsevent', '~> 0.9.4', require: false
|
24
|
+
gem 'rb-inotify', '~> 0.9.4', require: false
|
29
25
|
|
30
26
|
# notification handling
|
31
|
-
gem 'libnotify', '~> 0.8.
|
27
|
+
gem 'libnotify', '~> 0.8.2', require: false
|
32
28
|
gem 'rb-notifu', '~> 0.0.4', require: false
|
33
29
|
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
34
30
|
end
|
@@ -37,9 +33,9 @@ group :metrics do
|
|
37
33
|
gem 'coveralls', '~> 0.7.0'
|
38
34
|
gem 'flay', '~> 2.4.0'
|
39
35
|
gem 'flog', '~> 4.2.0'
|
40
|
-
gem 'reek', '~> 1.3.
|
41
|
-
gem 'rubocop', '~> 0.
|
42
|
-
gem 'simplecov', '~> 0.
|
36
|
+
gem 'reek', '~> 1.3.7'
|
37
|
+
gem 'rubocop', '~> 0.21.0'
|
38
|
+
gem 'simplecov', '~> 0.7.1'
|
43
39
|
gem 'yardstick', '~> 0.9.9'
|
44
40
|
|
45
41
|
platforms :ruby_19, :ruby_20 do
|
@@ -48,10 +44,10 @@ group :metrics do
|
|
48
44
|
|
49
45
|
platform :rbx do
|
50
46
|
gem 'json', '~> 1.8.1'
|
51
|
-
gem 'racc', '~> 1.4'
|
47
|
+
gem 'racc', '~> 1.4.11'
|
52
48
|
gem 'rubysl-logger', '~> 2.0.0'
|
53
49
|
gem 'rubysl-open-uri', '~> 2.0.0'
|
54
|
-
gem 'rubysl-prettyprint', '~> 2.0.
|
50
|
+
gem 'rubysl-prettyprint', '~> 2.0.3'
|
55
51
|
end
|
56
52
|
end
|
57
53
|
|
@@ -61,6 +57,6 @@ end
|
|
61
57
|
|
62
58
|
platform :jruby do
|
63
59
|
group :jruby do
|
64
|
-
gem 'jruby-openssl', '~> 0.
|
60
|
+
gem 'jruby-openssl', '~> 0.9.4'
|
65
61
|
end
|
66
62
|
end
|
data/config/flay.yml
CHANGED
data/config/rubocop.yml
CHANGED
@@ -7,7 +7,7 @@ inherit_from: ../.rubocop.yml
|
|
7
7
|
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
|
10
|
+
Include:
|
11
11
|
- '../**/*.rake'
|
12
12
|
- 'Gemfile'
|
13
13
|
- 'Gemfile.triage'
|
@@ -30,6 +30,19 @@ CollectionMethods:
|
|
30
30
|
find: 'detect'
|
31
31
|
find_all: 'select'
|
32
32
|
|
33
|
+
# Use square brackets for literal Array objects
|
34
|
+
PercentLiteralDelimiters:
|
35
|
+
PreferredDelimiters:
|
36
|
+
'%': ()
|
37
|
+
'%i': '[]'
|
38
|
+
'%q': ()
|
39
|
+
'%Q': ()
|
40
|
+
'%r': '{}'
|
41
|
+
'%s': ()
|
42
|
+
'%w': '[]'
|
43
|
+
'%W': '[]'
|
44
|
+
'%x': ()
|
45
|
+
|
33
46
|
MethodLength:
|
34
47
|
CountComments: false
|
35
48
|
Max: 17 # TODO: Bring down to 10
|
data/lib/mutant/cli.rb
CHANGED
@@ -285,7 +285,7 @@ module Mutant
|
|
285
285
|
# @api private
|
286
286
|
#
|
287
287
|
def use(name)
|
288
|
-
require "mutant
|
288
|
+
require "mutant/#{name}"
|
289
289
|
@strategy = Strategy.lookup(name).new
|
290
290
|
rescue LoadError
|
291
291
|
$stderr.puts("Cannot load plugin: #{name.inspect}")
|
@@ -339,7 +339,7 @@ module Mutant
|
|
339
339
|
def add_debug_options(opts)
|
340
340
|
opts.on('--fail-fast', 'Fail fast') do
|
341
341
|
@fail_fast = true
|
342
|
-
end.on('--version', 'Print mutants version') do
|
342
|
+
end.on('--version', 'Print mutants version') do
|
343
343
|
puts("mutant-#{Mutant::VERSION}")
|
344
344
|
Kernel.exit(0)
|
345
345
|
end.on('-d', '--debug', 'Enable debugging output') do
|
data/lib/mutant/constants.rb
CHANGED
@@ -5,20 +5,20 @@ module Mutant
|
|
5
5
|
symbolset = ->(strings) { strings.map(&:to_sym).to_set.freeze }
|
6
6
|
|
7
7
|
# Set of nodes that cannot be on the LHS of an assignment
|
8
|
-
NOT_ASSIGNABLE = symbolset.(%w
|
8
|
+
NOT_ASSIGNABLE = symbolset.(%w[int float str dstr class module self])
|
9
9
|
|
10
10
|
# Set of op-assign types
|
11
|
-
OP_ASSIGN = symbolset.call(%w
|
11
|
+
OP_ASSIGN = symbolset.call(%w[or_asgn and_asgn op_asgn])
|
12
12
|
# Set of node types that are not valid when emitted standalone
|
13
|
-
NOT_STANDALONE = symbolset.(%w
|
14
|
-
INDEX_OPERATORS = symbolset.(%w
|
15
|
-
UNARY_METHOD_OPERATORS = symbolset.(%w
|
13
|
+
NOT_STANDALONE = symbolset.(%w[ splat restarg block_pass])
|
14
|
+
INDEX_OPERATORS = symbolset.(%w[[] []=])
|
15
|
+
UNARY_METHOD_OPERATORS = symbolset.(%w[~@ +@ -@ !])
|
16
16
|
|
17
17
|
# Operators ruby implementeds as methods
|
18
|
-
METHOD_OPERATORS = symbolset.(%w
|
18
|
+
METHOD_OPERATORS = symbolset.(%w[
|
19
19
|
<=> === []= [] <= >= == !~ != =~ <<
|
20
20
|
>> ** * % / | ^ & < > + - ~@ +@ -@ !
|
21
|
-
)
|
21
|
+
])
|
22
22
|
|
23
23
|
BINARY_METHOD_OPERATORS = (
|
24
24
|
METHOD_OPERATORS - (INDEX_OPERATORS + UNARY_METHOD_OPERATORS)
|
@@ -32,10 +32,10 @@ module Mutant
|
|
32
32
|
#
|
33
33
|
# not - 1.8 only, mutant does not support 1.8
|
34
34
|
#
|
35
|
-
NODE_BLACKLIST = symbolset.(%w
|
35
|
+
NODE_BLACKLIST = symbolset.(%w[not])
|
36
36
|
|
37
37
|
# Nodes that are NOT generated by parser but used by mutant / unparser.
|
38
|
-
NODE_EXTRA = symbolset.(%w
|
38
|
+
NODE_EXTRA = symbolset.(%w[empty])
|
39
39
|
|
40
40
|
NODE_TYPES = ((Parser::Meta::NODE_TYPES + NODE_EXTRA) - NODE_BLACKLIST).to_set.freeze
|
41
41
|
|
data/lib/mutant/matcher/null.rb
CHANGED
@@ -60,7 +60,7 @@ module Mutant
|
|
60
60
|
# @api private
|
61
61
|
#
|
62
62
|
def info(string, *arguments)
|
63
|
-
puts(
|
63
|
+
puts(format(string, *arguments))
|
64
64
|
end
|
65
65
|
|
66
66
|
# Print a status line to output
|
@@ -70,7 +70,7 @@ module Mutant
|
|
70
70
|
# @api private
|
71
71
|
#
|
72
72
|
def status(string, *arguments)
|
73
|
-
puts(colorize(status_color,
|
73
|
+
puts(colorize(status_color, format(string, *arguments)))
|
74
74
|
end
|
75
75
|
|
76
76
|
# Print a line to output
|
@@ -5,9 +5,9 @@ module Mutant
|
|
5
5
|
# Progress printer for configuration
|
6
6
|
class Config < self
|
7
7
|
|
8
|
-
handle(Mutant::Config)
|
8
|
+
handle(Mutant::Runner::Config)
|
9
9
|
|
10
|
-
delegate :
|
10
|
+
delegate :config
|
11
11
|
|
12
12
|
# Report configuration
|
13
13
|
#
|
@@ -18,10 +18,12 @@ module Mutant
|
|
18
18
|
# @api private
|
19
19
|
#
|
20
20
|
def run
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
if running?
|
22
|
+
info 'Mutant configuration:'
|
23
|
+
info 'Matcher: %s', config.matcher.inspect
|
24
|
+
info 'Strategy: %s', config.strategy.inspect
|
25
|
+
info 'Expect Coverage: %02f%%', config.expected_coverage.inspect
|
26
|
+
end
|
25
27
|
self
|
26
28
|
end
|
27
29
|
|
@@ -13,12 +13,15 @@ module Mutant
|
|
13
13
|
|
14
14
|
# Run printer
|
15
15
|
#
|
16
|
-
# @return [
|
16
|
+
# @return [self]
|
17
17
|
#
|
18
18
|
# @api private
|
19
19
|
#
|
20
20
|
def run
|
21
|
-
|
21
|
+
unless running?
|
22
|
+
char(success? ? SUCCESS : FAILURE)
|
23
|
+
end
|
24
|
+
self
|
22
25
|
end
|
23
26
|
|
24
27
|
private
|
@@ -2,30 +2,15 @@ module Mutant
|
|
2
2
|
class Reporter
|
3
3
|
class CLI
|
4
4
|
class Progress
|
5
|
-
# Subject results printer
|
6
|
-
class Subject < self
|
7
|
-
|
8
|
-
handle(Mutant::Subject)
|
9
|
-
|
10
|
-
# Run subject results printer
|
11
|
-
#
|
12
|
-
# @return [undefined]
|
13
|
-
#
|
14
|
-
# @api private
|
15
|
-
#
|
16
|
-
def run
|
17
|
-
puts(object.identification)
|
18
|
-
end
|
19
|
-
|
20
|
-
end # Subject
|
21
|
-
|
22
5
|
# Reporter for subject runners
|
23
|
-
class
|
6
|
+
class Subject < self
|
24
7
|
|
25
8
|
FORMAT = '(%02d/%02d) %3d%% - %0.02fs'.freeze
|
26
9
|
|
27
10
|
handle(Mutant::Runner::Subject)
|
28
11
|
|
12
|
+
delegate :running?, :tests, :subject
|
13
|
+
|
29
14
|
# Run printer
|
30
15
|
#
|
31
16
|
# @return [undefined]
|
@@ -33,8 +18,15 @@ module Mutant
|
|
33
18
|
# @api private
|
34
19
|
#
|
35
20
|
def run
|
36
|
-
|
37
|
-
|
21
|
+
if running?
|
22
|
+
puts(subject.identification)
|
23
|
+
tests.each do |test|
|
24
|
+
puts "- #{test.identification}"
|
25
|
+
end
|
26
|
+
else
|
27
|
+
print_progress_bar_finish
|
28
|
+
print_stats
|
29
|
+
end
|
38
30
|
self
|
39
31
|
end
|
40
32
|
|
@@ -23,13 +23,13 @@ module Mutant
|
|
23
23
|
#
|
24
24
|
def run
|
25
25
|
failed_subjects.each(&method(:visit))
|
26
|
-
info
|
27
|
-
info
|
28
|
-
info
|
29
|
-
info
|
30
|
-
info
|
31
|
-
info
|
32
|
-
info
|
26
|
+
info 'Subjects: %s', amount_subjects
|
27
|
+
info 'Mutations: %s', amount_mutations
|
28
|
+
info 'Kills: %s', amount_kills
|
29
|
+
info 'Alive: %s', amount_alive
|
30
|
+
info 'Runtime: %0.2fs', runtime
|
31
|
+
info 'Killtime: %0.2fs', killtime
|
32
|
+
info 'Overhead: %0.2f%%', overhead
|
33
33
|
status 'Coverage: %0.2f%%', coverage
|
34
34
|
status 'Expected: %0.2f%%', object.config.expected_coverage
|
35
35
|
print_generic_stats
|
data/lib/mutant/runner.rb
CHANGED
@@ -53,6 +53,16 @@ module Mutant
|
|
53
53
|
handler.new(config, object, *arguments)
|
54
54
|
end
|
55
55
|
|
56
|
+
# Test if runner is running
|
57
|
+
#
|
58
|
+
# Yeah this is evil. Should be refactored away
|
59
|
+
#
|
60
|
+
# @return [Boolean]
|
61
|
+
#
|
62
|
+
def running?
|
63
|
+
@running
|
64
|
+
end
|
65
|
+
|
56
66
|
# Return config
|
57
67
|
#
|
58
68
|
# @return [Mutant::Config]
|
@@ -73,7 +83,11 @@ module Mutant
|
|
73
83
|
@config = config
|
74
84
|
@stop = false
|
75
85
|
@start = Time.now
|
86
|
+
@running = true
|
87
|
+
progress(self)
|
76
88
|
run
|
89
|
+
@running = false
|
90
|
+
progress(self)
|
77
91
|
@end = Time.now
|
78
92
|
end
|
79
93
|
|
data/lib/mutant/runner/config.rb
CHANGED
data/lib/mutant/runner/killer.rb
CHANGED
@@ -32,6 +32,15 @@ module Mutant
|
|
32
32
|
@report.success?
|
33
33
|
end
|
34
34
|
|
35
|
+
# Test if this killer ALONE can determine if mutation is dead
|
36
|
+
#
|
37
|
+
# @return [Boolean]
|
38
|
+
#
|
39
|
+
def mutation_dead?
|
40
|
+
test_report = report.test_report
|
41
|
+
killer.mutation.should_fail? && test_report.failed?
|
42
|
+
end
|
43
|
+
|
35
44
|
# Initialize object
|
36
45
|
#
|
37
46
|
# @param [Config] config
|
@@ -46,6 +55,8 @@ module Mutant
|
|
46
55
|
super(config)
|
47
56
|
end
|
48
57
|
|
58
|
+
private
|
59
|
+
|
49
60
|
# Run killer
|
50
61
|
#
|
51
62
|
# @api private
|
@@ -63,14 +63,20 @@ module Mutant
|
|
63
63
|
# @api private
|
64
64
|
#
|
65
65
|
def run
|
66
|
-
|
67
|
-
|
66
|
+
@killers = []
|
67
|
+
|
68
|
+
killers = @tests.map do |test|
|
68
69
|
Mutant::Killer.new(
|
69
70
|
mutation: mutation,
|
70
71
|
test: test
|
71
72
|
)
|
72
|
-
end
|
73
|
-
|
73
|
+
end
|
74
|
+
|
75
|
+
killers.each do |killer|
|
76
|
+
runner = visit(killer)
|
77
|
+
@killers << runner
|
78
|
+
return if runner.mutation_dead?
|
79
|
+
end
|
74
80
|
end
|
75
81
|
|
76
82
|
end # Mutation
|
data/lib/mutant/strategy.rb
CHANGED
data/lib/mutant/version.rb
CHANGED
data/lib/mutant/zombifier.rb
CHANGED
@@ -6,16 +6,16 @@ module Mutant
|
|
6
6
|
include Adamantium::Flat, Concord.new(:namespace)
|
7
7
|
|
8
8
|
# Excluded into zombification
|
9
|
-
includes = %w
|
9
|
+
includes = %w[
|
10
10
|
mutant
|
11
11
|
morpher
|
12
12
|
adamantium
|
13
13
|
equalizer
|
14
14
|
anima
|
15
15
|
concord
|
16
|
-
|
16
|
+
]
|
17
17
|
|
18
|
-
INCLUDES = %r
|
18
|
+
INCLUDES = %r{\A#{Regexp.union(includes)}(?:/.*)?\z}.freeze
|
19
19
|
|
20
20
|
# Initialize object
|
21
21
|
#
|
data/mutant-rspec.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.license = 'MIT'
|
14
14
|
|
15
15
|
gem.require_paths = %w[lib]
|
16
|
-
gem.files = `git ls-files -- lib/mutant
|
16
|
+
gem.files = `git ls-files -- lib/mutant/rspec.rb lib/mutant/rspec`.split("\n")
|
17
17
|
gem.test_files = `git ls-files -- spec/{unit/mutant/rspec,integration/rspec}`.split("\n")
|
18
18
|
gem.extra_rdoc_files = %w[TODO LICENSE]
|
19
19
|
|
@@ -23,13 +23,14 @@ describe 'Mutant on ruby corpus' do
|
|
23
23
|
# @raise [Exception]
|
24
24
|
# otherwise
|
25
25
|
#
|
26
|
+
# rubocop:disable MethodLength
|
26
27
|
def verify
|
27
28
|
checkout
|
28
29
|
total = 0
|
29
30
|
parse_errors = []
|
30
31
|
start = Time.now
|
31
32
|
Pathname.glob(repo_path.join('**/*.rb')).sort.each do |path|
|
32
|
-
puts "Generating mutations for: #{path
|
33
|
+
puts "Generating mutations for: #{path}"
|
33
34
|
begin
|
34
35
|
node = Parser::CurrentRuby.parse(path.read)
|
35
36
|
# Ignore known parser bugs
|
@@ -39,7 +40,7 @@ describe 'Mutant on ruby corpus' do
|
|
39
40
|
end
|
40
41
|
next if node.nil?
|
41
42
|
count = 0
|
42
|
-
Mutant::Mutator::Node.each(node) do
|
43
|
+
Mutant::Mutator::Node.each(node) do
|
43
44
|
count += 1
|
44
45
|
if (count % 1000).zero?
|
45
46
|
puts count
|
@@ -49,9 +50,13 @@ describe 'Mutant on ruby corpus' do
|
|
49
50
|
total += count
|
50
51
|
end
|
51
52
|
took = Time.now - start
|
52
|
-
puts
|
53
|
-
|
54
|
-
|
53
|
+
puts format(
|
54
|
+
'Total Mutations/Time/Parse-Errors: %s/%0.2fs/%i - %0.2f/s',
|
55
|
+
total,
|
56
|
+
took,
|
57
|
+
parse_errors.size,
|
58
|
+
total / took
|
59
|
+
)
|
55
60
|
if parse_errors.any?
|
56
61
|
puts 'Files with parse errors:'
|
57
62
|
parse_errors.each(&method(:puts))
|
@@ -69,11 +74,11 @@ describe 'Mutant on ruby corpus' do
|
|
69
74
|
TMP.mkdir unless TMP.directory?
|
70
75
|
if repo_path.exist?
|
71
76
|
Dir.chdir(repo_path) do
|
72
|
-
system(%w
|
73
|
-
system(%w
|
77
|
+
system(%w[git pull origin master])
|
78
|
+
system(%w[git clean -f -d -x])
|
74
79
|
end
|
75
80
|
else
|
76
|
-
system(%W
|
81
|
+
system(%W[git clone #{repo_uri} #{repo_path}])
|
77
82
|
end
|
78
83
|
self
|
79
84
|
end
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe 'as a zombie' do
|
6
6
|
specify 'it allows to create zombie from mutant' do
|
7
|
-
expect { Mutant.zombify }.to change {
|
7
|
+
expect { Mutant.zombify }.to change { defined?(Zombie) }.from(nil).to('constant')
|
8
8
|
expect(Zombie.constants).to include(:Mutant)
|
9
9
|
end
|
10
10
|
end
|
@@ -15,7 +15,7 @@ shared_examples_for 'a cli parser' do
|
|
15
15
|
|
16
16
|
it { expect(subject.strategy).to eql(expected_strategy) }
|
17
17
|
it { expect(subject.reporter).to eql(expected_reporter) }
|
18
|
-
it { expect(subject.matcher).to
|
18
|
+
it { expect(subject.matcher).to eql(expected_matcher) }
|
19
19
|
end
|
20
20
|
|
21
21
|
describe Mutant::CLI, '.new' do
|
@@ -39,7 +39,7 @@ describe Mutant::CLI, '.new' do
|
|
39
39
|
subject { cli }
|
40
40
|
|
41
41
|
context 'with unknown flag' do
|
42
|
-
let(:arguments) { %w
|
42
|
+
let(:arguments) { %w[--invalid] }
|
43
43
|
|
44
44
|
let(:expected_message) { 'invalid option: --invalid' }
|
45
45
|
|
@@ -47,7 +47,7 @@ describe Mutant::CLI, '.new' do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
context 'with unknown option' do
|
50
|
-
let(:arguments) { %w
|
50
|
+
let(:arguments) { %w[--invalid Foo] }
|
51
51
|
|
52
52
|
let(:expected_message) { 'invalid option: --invalid' }
|
53
53
|
|
@@ -63,14 +63,14 @@ describe Mutant::CLI, '.new' do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'with code filter and missing argument' do
|
66
|
-
let(:arguments) { %w
|
66
|
+
let(:arguments) { %w[--code] }
|
67
67
|
let(:expected_message) { 'missing argument: --code' }
|
68
68
|
|
69
69
|
it_should_behave_like 'an invalid cli run'
|
70
70
|
end
|
71
71
|
|
72
72
|
context 'with explicit method pattern' do
|
73
|
-
let(:arguments) { %w
|
73
|
+
let(:arguments) { %w[TestApp::Literal#float] }
|
74
74
|
|
75
75
|
let(:expected_matcher) do
|
76
76
|
ns::Method::Instance.new(cache, TestApp::Literal, TestApp::Literal.instance_method(:float))
|
@@ -81,7 +81,7 @@ describe Mutant::CLI, '.new' do
|
|
81
81
|
|
82
82
|
context 'with debug flag' do
|
83
83
|
let(:pattern) { '::TestApp*' }
|
84
|
-
let(:arguments) { %W
|
84
|
+
let(:arguments) { %W[--debug #{pattern}] }
|
85
85
|
let(:expected_matcher) { ns::Namespace.new(cache, TestApp) }
|
86
86
|
|
87
87
|
it_should_behave_like 'a cli parser'
|
@@ -93,7 +93,7 @@ describe Mutant::CLI, '.new' do
|
|
93
93
|
|
94
94
|
context 'with zombie flag' do
|
95
95
|
let(:pattern) { '::TestApp*' }
|
96
|
-
let(:arguments) { %W
|
96
|
+
let(:arguments) { %W[--zombie #{pattern}] }
|
97
97
|
let(:expected_matcher) { ns::Namespace.new(cache, TestApp) }
|
98
98
|
|
99
99
|
it_should_behave_like 'a cli parser'
|
@@ -104,8 +104,8 @@ describe Mutant::CLI, '.new' do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
context 'with namespace pattern' do
|
107
|
-
let(:pattern) { '::TestApp*'
|
108
|
-
let(:arguments) {
|
107
|
+
let(:pattern) { '::TestApp*' }
|
108
|
+
let(:arguments) { [pattern] }
|
109
109
|
let(:expected_matcher) { ns::Namespace.new(cache, TestApp) }
|
110
110
|
|
111
111
|
it_should_behave_like 'a cli parser'
|
@@ -113,7 +113,7 @@ describe Mutant::CLI, '.new' do
|
|
113
113
|
|
114
114
|
context 'with subject code filter' do
|
115
115
|
let(:pattern) { 'TestApp::Literal#float' }
|
116
|
-
let(:arguments) { %W
|
116
|
+
let(:arguments) { %W[--code faa --code bbb #{pattern}] }
|
117
117
|
|
118
118
|
let(:expected_filter) do
|
119
119
|
Morpher.evaluator(
|
@@ -12,7 +12,7 @@ describe Mutant::Diff do
|
|
12
12
|
let(:old_string) { "foo\nbar" }
|
13
13
|
let(:new_string) { "bar\nbaz" }
|
14
14
|
|
15
|
-
it { should eql(Mutant::Diff.new(%w
|
15
|
+
it { should eql(Mutant::Diff.new(%w[foo bar], %w[bar baz])) }
|
16
16
|
|
17
17
|
end
|
18
18
|
|
@@ -46,8 +46,8 @@ describe Mutant::Diff do
|
|
46
46
|
subject { object.diff }
|
47
47
|
|
48
48
|
context 'when there is a diff at begin of hunk' do
|
49
|
-
let(:old) { %w
|
50
|
-
let(:new) { %w
|
49
|
+
let(:old) { %w[foo bar] }
|
50
|
+
let(:new) { %w[baz bar] }
|
51
51
|
|
52
52
|
let(:expectation) do
|
53
53
|
strip_indent(<<-STR)
|
@@ -64,8 +64,8 @@ describe Mutant::Diff do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'when there is a diff NOT at begin of hunk' do
|
67
|
-
let(:old) { %w
|
68
|
-
let(:new) { %w
|
67
|
+
let(:old) { %w[foo bar] }
|
68
|
+
let(:new) { %w[foo baz bar] }
|
69
69
|
|
70
70
|
let(:expectation) do
|
71
71
|
strip_indent(<<-STR)
|
@@ -82,8 +82,8 @@ describe Mutant::Diff do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
context 'when the diff has a long context at begin' do
|
85
|
-
let(:old) { %w
|
86
|
-
let(:new) { %w
|
85
|
+
let(:old) { %w[foo bar baz boz a b c] }
|
86
|
+
let(:new) { %w[foo bar baz boz a b c other] }
|
87
87
|
|
88
88
|
let(:expectation) do
|
89
89
|
strip_indent(<<-STR)
|
@@ -105,8 +105,8 @@ describe Mutant::Diff do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
context 'when the diff has a long context at end, deleting' do
|
108
|
-
let(:old) { %w
|
109
|
-
let(:new) { %w
|
108
|
+
let(:old) { %w[other foo bar baz boz a b c] }
|
109
|
+
let(:new) { %w[foo bar baz boz a b c] }
|
110
110
|
|
111
111
|
let(:expectation) do
|
112
112
|
strip_indent(<<-STR)
|
@@ -128,8 +128,8 @@ describe Mutant::Diff do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
context 'when the diff has a long context at end, inserting' do
|
131
|
-
let(:old) { %w
|
132
|
-
let(:new) { %w
|
131
|
+
let(:old) { %w[foo bar baz boz a b c] }
|
132
|
+
let(:new) { %w[other foo bar baz boz a b c] }
|
133
133
|
|
134
134
|
let(:expectation) do
|
135
135
|
strip_indent(<<-STR)
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
+
# rubocop:disable ClassAndModuleChildren
|
5
6
|
describe Mutant::Matcher::Method::Instance do
|
6
7
|
|
7
8
|
let(:cache) { Fixtures::AST_CACHE }
|
@@ -44,7 +45,7 @@ describe Mutant::Matcher::Method::Instance do
|
|
44
45
|
def bar
|
45
46
|
end
|
46
47
|
|
47
|
-
def bar(
|
48
|
+
def bar(_arg)
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
@@ -57,7 +58,7 @@ describe Mutant::Matcher::Method::Instance do
|
|
57
58
|
context 'on the same line' do
|
58
59
|
let(:base) { __LINE__ }
|
59
60
|
class self::Foo
|
60
|
-
def bar; end; def bar(
|
61
|
+
def bar; end; def bar(_arg); end
|
61
62
|
end
|
62
63
|
|
63
64
|
let(:method_line) { 2 }
|
@@ -69,7 +70,7 @@ describe Mutant::Matcher::Method::Instance do
|
|
69
70
|
context 'on the same line with differend scope' do
|
70
71
|
let(:base) { __LINE__ }
|
71
72
|
class self::Foo
|
72
|
-
def self.bar; end; def bar(
|
73
|
+
def self.bar; end; def bar(_arg); end
|
73
74
|
end
|
74
75
|
|
75
76
|
let(:method_line) { 2 }
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
+
# rubocop:disable ClassAndModuleChildren
|
5
6
|
describe Mutant::Matcher::Method::Singleton, '#each' do
|
6
7
|
subject { object.each { |subject| yields << subject } }
|
7
8
|
|
@@ -80,7 +81,7 @@ describe Mutant::Matcher::Method::Singleton, '#each' do
|
|
80
81
|
module Bar
|
81
82
|
def self.baz
|
82
83
|
end
|
83
|
-
def Foo.baz(
|
84
|
+
def Foo.baz(_arg)
|
84
85
|
end
|
85
86
|
end
|
86
87
|
end
|
@@ -7,7 +7,7 @@ describe Mutant::Mutator::Node::Literal, 'boolean' do
|
|
7
7
|
let(:source) { 'true' }
|
8
8
|
|
9
9
|
let(:mutations) do
|
10
|
-
%w
|
10
|
+
%w[nil false]
|
11
11
|
end
|
12
12
|
|
13
13
|
it_should_behave_like 'a mutator'
|
@@ -17,7 +17,7 @@ describe Mutant::Mutator::Node::Literal, 'boolean' do
|
|
17
17
|
let(:source) { 'false' }
|
18
18
|
|
19
19
|
let(:mutations) do
|
20
|
-
%w
|
20
|
+
%w[nil true]
|
21
21
|
end
|
22
22
|
|
23
23
|
it_should_behave_like 'a mutator'
|
@@ -5,23 +5,25 @@ require 'spec_helper'
|
|
5
5
|
describe Mutant::Runner::Mutation do
|
6
6
|
let(:object) { described_class.new(config, mutation, tests) }
|
7
7
|
|
8
|
-
let(:reporter) { double('Reporter')
|
9
|
-
let(:mutation) { double('Mutation', class: Mutant::Mutation)
|
10
|
-
let(:strategy) { double('Strategy')
|
11
|
-
let(:killer_a) { Mutant::Killer.new(test: test_a, mutation: mutation)
|
12
|
-
let(:killer_b) { Mutant::Killer.new(test: test_b, mutation: mutation)
|
13
|
-
let(:runner_a) { double('Runner A', success?: success_a, stop?: stop_a) }
|
14
|
-
let(:runner_b) { double('Runner B', success?: success_b, stop?: stop_b) }
|
15
|
-
let(:runners) { [runner_a, runner_b]
|
16
|
-
let(:killers) { [killer_a, killer_b]
|
17
|
-
let(:fail_fast) { false
|
18
|
-
let(:success_a) { true
|
19
|
-
let(:success_b) { true
|
20
|
-
let(:stop_a) { false
|
21
|
-
let(:stop_b) { false
|
22
|
-
let(:
|
23
|
-
let(:
|
24
|
-
let(:
|
8
|
+
let(:reporter) { double('Reporter') }
|
9
|
+
let(:mutation) { double('Mutation', class: Mutant::Mutation) }
|
10
|
+
let(:strategy) { double('Strategy') }
|
11
|
+
let(:killer_a) { Mutant::Killer.new(test: test_a, mutation: mutation) }
|
12
|
+
let(:killer_b) { Mutant::Killer.new(test: test_b, mutation: mutation) }
|
13
|
+
let(:runner_a) { double('Runner A', success?: success_a, stop?: stop_a, mutation_dead?: dead_a) }
|
14
|
+
let(:runner_b) { double('Runner B', success?: success_b, stop?: stop_b, mutation_dead?: dead_b) }
|
15
|
+
let(:runners) { [runner_a, runner_b] }
|
16
|
+
let(:killers) { [killer_a, killer_b] }
|
17
|
+
let(:fail_fast) { false }
|
18
|
+
let(:success_a) { true }
|
19
|
+
let(:success_b) { true }
|
20
|
+
let(:stop_a) { false }
|
21
|
+
let(:stop_b) { false }
|
22
|
+
let(:dead_a) { false }
|
23
|
+
let(:dead_b) { false }
|
24
|
+
let(:test_a) { double('test a') }
|
25
|
+
let(:test_b) { double('test b') }
|
26
|
+
let(:tests) { [test_a, test_b] }
|
25
27
|
|
26
28
|
before do
|
27
29
|
expect(Mutant::Runner).to receive(:run).with(config, killer_a).and_return(runner_a)
|
data/test_app/Gemfile.devtools
CHANGED
@@ -1,34 +1,30 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake', '~> 10.1
|
5
|
-
gem 'rspec', '~> 2.
|
6
|
-
gem 'rspec-core', '~> 2.
|
7
|
-
gem 'yard', '~> 0.8.7'
|
4
|
+
gem 'rake', '~> 10.3.1'
|
5
|
+
gem 'rspec', '~> 2.99.0.beta2'
|
6
|
+
gem 'rspec-core', '~> 2.99.0.beta2'
|
7
|
+
gem 'yard', '~> 0.8.7.4'
|
8
8
|
|
9
9
|
platform :rbx do
|
10
10
|
gem 'rubysl-singleton', '~> 2.0.0'
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
group :yard do
|
15
|
-
gem 'kramdown', '~> 1.3.2'
|
16
|
-
end
|
17
|
-
|
18
14
|
group :guard do
|
19
|
-
gem 'guard', '~> 2.
|
15
|
+
gem 'guard', '~> 2.6.0'
|
20
16
|
gem 'guard-bundler', '~> 2.0.0'
|
21
|
-
gem 'guard-rspec', '~> 4.2.
|
22
|
-
gem 'guard-rubocop', '~> 1.0
|
17
|
+
gem 'guard-rspec', '~> 4.2.8'
|
18
|
+
gem 'guard-rubocop', '~> 1.1.0'
|
23
19
|
|
24
20
|
# file system change event handling
|
25
|
-
gem 'listen', '~> 2.
|
21
|
+
gem 'listen', '~> 2.7.3'
|
26
22
|
gem 'rb-fchange', '~> 0.0.6', require: false
|
27
|
-
gem 'rb-fsevent', '~> 0.9.
|
28
|
-
gem 'rb-inotify', '~> 0.9.
|
23
|
+
gem 'rb-fsevent', '~> 0.9.4', require: false
|
24
|
+
gem 'rb-inotify', '~> 0.9.4', require: false
|
29
25
|
|
30
26
|
# notification handling
|
31
|
-
gem 'libnotify', '~> 0.8.
|
27
|
+
gem 'libnotify', '~> 0.8.2', require: false
|
32
28
|
gem 'rb-notifu', '~> 0.0.4', require: false
|
33
29
|
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
34
30
|
end
|
@@ -37,9 +33,9 @@ group :metrics do
|
|
37
33
|
gem 'coveralls', '~> 0.7.0'
|
38
34
|
gem 'flay', '~> 2.4.0'
|
39
35
|
gem 'flog', '~> 4.2.0'
|
40
|
-
gem 'reek', '~> 1.3.
|
41
|
-
gem 'rubocop', '~> 0.
|
42
|
-
gem 'simplecov', '~> 0.
|
36
|
+
gem 'reek', '~> 1.3.7'
|
37
|
+
gem 'rubocop', '~> 0.21.0'
|
38
|
+
gem 'simplecov', '~> 0.7.1'
|
43
39
|
gem 'yardstick', '~> 0.9.9'
|
44
40
|
|
45
41
|
platforms :ruby_19, :ruby_20 do
|
@@ -48,10 +44,10 @@ group :metrics do
|
|
48
44
|
|
49
45
|
platform :rbx do
|
50
46
|
gem 'json', '~> 1.8.1'
|
51
|
-
gem 'racc', '~> 1.4'
|
47
|
+
gem 'racc', '~> 1.4.11'
|
52
48
|
gem 'rubysl-logger', '~> 2.0.0'
|
53
49
|
gem 'rubysl-open-uri', '~> 2.0.0'
|
54
|
-
gem 'rubysl-prettyprint', '~> 2.0.
|
50
|
+
gem 'rubysl-prettyprint', '~> 2.0.3'
|
55
51
|
end
|
56
52
|
end
|
57
53
|
|
@@ -61,6 +57,6 @@ end
|
|
61
57
|
|
62
58
|
platform :jruby do
|
63
59
|
group :jruby do
|
64
|
-
gem 'jruby-openssl', '~> 0.
|
60
|
+
gem 'jruby-openssl', '~> 0.9.4'
|
65
61
|
end
|
66
62
|
end
|