mutant 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +9 -0
  3. data/README.md +1 -1
  4. data/Rakefile +12 -8
  5. data/bin/mutant +5 -1
  6. data/config/flay.yml +1 -1
  7. data/lib/mutant.rb +18 -17
  8. data/lib/mutant/actor.rb +1 -7
  9. data/lib/mutant/actor/env.rb +0 -4
  10. data/lib/mutant/actor/mailbox.rb +0 -4
  11. data/lib/mutant/actor/receiver.rb +0 -4
  12. data/lib/mutant/actor/sender.rb +0 -2
  13. data/lib/mutant/ast.rb +1 -5
  14. data/lib/mutant/ast/meta/const.rb +0 -2
  15. data/lib/mutant/ast/meta/optarg.rb +0 -2
  16. data/lib/mutant/ast/meta/send.rb +0 -12
  17. data/lib/mutant/ast/named_children.rb +0 -10
  18. data/lib/mutant/ast/sexp.rb +1 -5
  19. data/lib/mutant/cli.rb +19 -38
  20. data/lib/mutant/color.rb +1 -7
  21. data/lib/mutant/config.rb +11 -7
  22. data/lib/mutant/context.rb +0 -4
  23. data/lib/mutant/context/scope.rb +0 -18
  24. data/lib/mutant/delegator.rb +0 -6
  25. data/lib/mutant/diff.rb +0 -18
  26. data/lib/mutant/env.rb +8 -24
  27. data/lib/mutant/env/bootstrap.rb +18 -41
  28. data/lib/mutant/expression.rb +0 -8
  29. data/lib/mutant/expression/method.rb +6 -7
  30. data/lib/mutant/expression/methods.rb +5 -9
  31. data/lib/mutant/expression/namespace.rb +0 -13
  32. data/lib/mutant/expression/parser.rb +0 -6
  33. data/lib/mutant/integration.rb +2 -20
  34. data/lib/mutant/isolation.rb +0 -4
  35. data/lib/mutant/loader.rb +20 -35
  36. data/lib/mutant/matcher.rb +1 -1
  37. data/lib/mutant/matcher/chain.rb +1 -3
  38. data/lib/mutant/matcher/compiler.rb +0 -8
  39. data/lib/mutant/matcher/config.rb +2 -10
  40. data/lib/mutant/matcher/filter.rb +1 -3
  41. data/lib/mutant/matcher/method.rb +4 -26
  42. data/lib/mutant/matcher/method/instance.rb +1 -7
  43. data/lib/mutant/matcher/method/singleton.rb +0 -12
  44. data/lib/mutant/matcher/methods.rb +1 -19
  45. data/lib/mutant/matcher/namespace.rb +1 -7
  46. data/lib/mutant/matcher/null.rb +1 -3
  47. data/lib/mutant/matcher/scope.rb +1 -5
  48. data/lib/mutant/matcher/static.rb +0 -2
  49. data/lib/mutant/meta.rb +0 -2
  50. data/lib/mutant/meta/example.rb +0 -28
  51. data/lib/mutant/meta/example/dsl.rb +2 -16
  52. data/lib/mutant/mutation.rb +9 -18
  53. data/lib/mutant/mutator.rb +0 -24
  54. data/lib/mutant/mutator/node.rb +1 -33
  55. data/lib/mutant/mutator/node/and_asgn.rb +0 -2
  56. data/lib/mutant/mutator/node/argument.rb +0 -10
  57. data/lib/mutant/mutator/node/arguments.rb +0 -12
  58. data/lib/mutant/mutator/node/begin.rb +0 -4
  59. data/lib/mutant/mutator/node/binary.rb +2 -11
  60. data/lib/mutant/mutator/node/block.rb +0 -6
  61. data/lib/mutant/mutator/node/break.rb +0 -2
  62. data/lib/mutant/mutator/node/case.rb +0 -6
  63. data/lib/mutant/mutator/node/conditional_loop.rb +0 -2
  64. data/lib/mutant/mutator/node/const.rb +1 -3
  65. data/lib/mutant/mutator/node/define.rb +4 -11
  66. data/lib/mutant/mutator/node/defined.rb +0 -2
  67. data/lib/mutant/mutator/node/dstr.rb +0 -2
  68. data/lib/mutant/mutator/node/dsym.rb +0 -2
  69. data/lib/mutant/mutator/node/generic.rb +1 -3
  70. data/lib/mutant/mutator/node/if.rb +0 -8
  71. data/lib/mutant/mutator/node/kwbegin.rb +0 -2
  72. data/lib/mutant/mutator/node/literal/array.rb +0 -4
  73. data/lib/mutant/mutator/node/literal/boolean.rb +0 -2
  74. data/lib/mutant/mutator/node/literal/fixnum.rb +0 -6
  75. data/lib/mutant/mutator/node/literal/float.rb +0 -6
  76. data/lib/mutant/mutator/node/literal/hash.rb +0 -6
  77. data/lib/mutant/mutator/node/literal/nil.rb +0 -2
  78. data/lib/mutant/mutator/node/literal/range.rb +0 -8
  79. data/lib/mutant/mutator/node/literal/regex.rb +0 -4
  80. data/lib/mutant/mutator/node/literal/string.rb +0 -2
  81. data/lib/mutant/mutator/node/literal/symbol.rb +0 -2
  82. data/lib/mutant/mutator/node/masgn.rb +0 -2
  83. data/lib/mutant/mutator/node/match_current_line.rb +0 -2
  84. data/lib/mutant/mutator/node/mlhs.rb +0 -2
  85. data/lib/mutant/mutator/node/named_value/access.rb +0 -8
  86. data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -7
  87. data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -4
  88. data/lib/mutant/mutator/node/next.rb +0 -2
  89. data/lib/mutant/mutator/node/noop.rb +0 -2
  90. data/lib/mutant/mutator/node/nthref.rb +0 -2
  91. data/lib/mutant/mutator/node/op_asgn.rb +0 -2
  92. data/lib/mutant/mutator/node/or_asgn.rb +0 -2
  93. data/lib/mutant/mutator/node/resbody.rb +0 -4
  94. data/lib/mutant/mutator/node/rescue.rb +0 -10
  95. data/lib/mutant/mutator/node/return.rb +0 -2
  96. data/lib/mutant/mutator/node/send.rb +4 -32
  97. data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -6
  98. data/lib/mutant/mutator/node/send/binary.rb +0 -6
  99. data/lib/mutant/mutator/node/send/index.rb +0 -6
  100. data/lib/mutant/mutator/node/splat.rb +0 -2
  101. data/lib/mutant/mutator/node/super.rb +0 -2
  102. data/lib/mutant/mutator/node/when.rb +0 -10
  103. data/lib/mutant/mutator/node/yield.rb +0 -2
  104. data/lib/mutant/mutator/node/zsuper.rb +0 -2
  105. data/lib/mutant/mutator/registry.rb +0 -6
  106. data/lib/mutant/mutator/util.rb +0 -4
  107. data/lib/mutant/mutator/util/array.rb +0 -6
  108. data/lib/mutant/mutator/util/symbol.rb +0 -2
  109. data/lib/mutant/parallel.rb +21 -17
  110. data/lib/mutant/parallel/master.rb +0 -28
  111. data/lib/mutant/parallel/source.rb +0 -10
  112. data/lib/mutant/parallel/worker.rb +15 -10
  113. data/lib/mutant/parser.rb +23 -0
  114. data/lib/mutant/reporter.rb +5 -8
  115. data/lib/mutant/reporter/cli.rb +1 -15
  116. data/lib/mutant/reporter/cli/format.rb +3 -25
  117. data/lib/mutant/reporter/cli/printer.rb +0 -18
  118. data/lib/mutant/reporter/cli/printer/config.rb +0 -2
  119. data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -2
  120. data/lib/mutant/reporter/cli/printer/env_result.rb +0 -2
  121. data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -4
  122. data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -16
  123. data/lib/mutant/reporter/cli/printer/status.rb +0 -6
  124. data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -4
  125. data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -8
  126. data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -2
  127. data/lib/mutant/reporter/cli/printer/test_result.rb +0 -2
  128. data/lib/mutant/reporter/cli/tput.rb +0 -4
  129. data/lib/mutant/repository.rb +4 -22
  130. data/lib/mutant/require_highjack.rb +0 -2
  131. data/lib/mutant/result.rb +23 -43
  132. data/lib/mutant/runner.rb +7 -20
  133. data/lib/mutant/runner/sink.rb +43 -86
  134. data/lib/mutant/selector.rb +0 -2
  135. data/lib/mutant/selector/expression.rb +0 -2
  136. data/lib/mutant/subject.rb +0 -22
  137. data/lib/mutant/subject/method.rb +2 -10
  138. data/lib/mutant/subject/method/instance.rb +0 -6
  139. data/lib/mutant/subject/method/singleton.rb +0 -2
  140. data/lib/mutant/test.rb +4 -3
  141. data/lib/mutant/version.rb +1 -1
  142. data/lib/mutant/warning_filter.rb +0 -10
  143. data/lib/mutant/zombifier.rb +5 -20
  144. data/meta/or_asgn.rb +6 -0
  145. data/meta/send.rb +29 -0
  146. data/mutant-rspec.gemspec +1 -1
  147. data/spec/integration/mutant/rspec_spec.rb +1 -1
  148. data/spec/integrations.yml +2 -3
  149. data/spec/shared/method_matcher_behavior.rb +7 -7
  150. data/spec/spec_helper.rb +2 -9
  151. data/spec/support/corpus.rb +37 -30
  152. data/spec/support/rb_bug.rb +1 -2
  153. data/spec/support/ruby_vm.rb +6 -3
  154. data/spec/support/shared_context.rb +19 -20
  155. data/spec/unit/mutant/actor/binding_spec.rb +6 -6
  156. data/spec/unit/mutant/actor/env_spec.rb +2 -2
  157. data/spec/unit/mutant/actor/mailbox_spec.rb +6 -6
  158. data/spec/unit/mutant/actor/message_spec.rb +2 -2
  159. data/spec/unit/mutant/actor/receiver_spec.rb +4 -4
  160. data/spec/unit/mutant/actor/sender_spec.rb +6 -6
  161. data/spec/unit/mutant/ast_spec.rb +9 -0
  162. data/spec/unit/mutant/cli_spec.rb +16 -10
  163. data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
  164. data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
  165. data/spec/unit/mutant/context/scope_spec.rb +3 -3
  166. data/spec/unit/mutant/context_spec.rb +0 -22
  167. data/spec/unit/mutant/env/boostrap_spec.rb +34 -41
  168. data/spec/unit/mutant/env_spec.rb +74 -32
  169. data/spec/unit/mutant/integration/rspec_spec.rb +23 -17
  170. data/spec/unit/mutant/integration_spec.rb +4 -4
  171. data/spec/unit/mutant/isolation_spec.rb +4 -4
  172. data/spec/unit/mutant/loader_spec.rb +42 -0
  173. data/spec/unit/mutant/matcher/compiler_spec.rb +3 -3
  174. data/spec/unit/mutant/matcher/config_spec.rb +1 -1
  175. data/spec/unit/mutant/matcher/method/instance_spec.rb +8 -1
  176. data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -1
  177. data/spec/unit/mutant/matcher/namespace_spec.rb +7 -8
  178. data/spec/unit/mutant/matcher/null_spec.rb +3 -2
  179. data/spec/unit/mutant/mutation_spec.rb +11 -5
  180. data/spec/unit/mutant/mutator/registry_spec.rb +1 -1
  181. data/spec/unit/mutant/parallel/master_spec.rb +9 -9
  182. data/spec/unit/mutant/parallel/source/array_spec.rb +3 -3
  183. data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
  184. data/spec/unit/mutant/parallel_spec.rb +4 -4
  185. data/spec/unit/mutant/parser_spec.rb +24 -0
  186. data/spec/unit/mutant/reporter/cli/printer_spec.rb +3 -3
  187. data/spec/unit/mutant/reporter/cli/tput_spec.rb +2 -2
  188. data/spec/unit/mutant/reporter/cli_spec.rb +7 -7
  189. data/spec/unit/mutant/reporter/null_spec.rb +5 -4
  190. data/spec/unit/mutant/repository/diff_spec.rb +30 -18
  191. data/spec/unit/mutant/repository/subject_filter_spec.rb +5 -5
  192. data/spec/unit/mutant/require_highjack_spec.rb +1 -1
  193. data/spec/unit/mutant/result/env_spec.rb +9 -9
  194. data/spec/unit/mutant/result/subject_spec.rb +5 -5
  195. data/spec/unit/mutant/runner/driver_spec.rb +4 -4
  196. data/spec/unit/mutant/runner/{sink/mutation_spec.rb → sink_spec.rb} +16 -4
  197. data/spec/unit/mutant/runner_spec.rb +31 -31
  198. data/spec/unit/mutant/selector/expression_spec.rb +8 -8
  199. data/spec/unit/mutant/subject/method/instance_spec.rb +9 -3
  200. data/spec/unit/mutant/subject/method/singleton_spec.rb +1 -1
  201. data/spec/unit/mutant/subject_spec.rb +1 -5
  202. data/spec/unit/mutant_spec.rb +3 -3
  203. metadata +9 -15
  204. data/config/mutant.yml +0 -14
  205. data/lib/mutant/cache.rb +0 -29
  206. data/lib/mutant/reporter/trace.rb +0 -36
  207. data/spec/support/rspec.rb +0 -21
  208. data/spec/unit/mutant/cache_spec.rb +0 -22
  209. data/spec/unit/mutant/loader/eval_spec.rb +0 -44
  210. data/spec/unit/mutant/reporter/trace_spec.rb +0 -21
  211. data/test_app/Gemfile.rspec3.2 +0 -7
@@ -19,8 +19,6 @@ module Mutant
19
19
  # Run printer
20
20
  #
21
21
  # @return [undefined]
22
- #
23
- # @api private
24
22
  def run
25
23
  status(
26
24
  FORMAT,
@@ -38,8 +36,6 @@ module Mutant
38
36
  # Object being printed
39
37
  #
40
38
  # @return [Result::Env]
41
- #
42
- # @api private
43
39
  def object
44
40
  super().payload
45
41
  end
@@ -21,8 +21,6 @@ module Mutant
21
21
  # Run printer
22
22
  #
23
23
  # @return [undefined]
24
- #
25
- # @api private
26
24
  def run
27
25
  puts("#{subject.identification} mutations: #{amount_mutations}")
28
26
  print_mutation_results
@@ -35,8 +33,6 @@ module Mutant
35
33
  # Print stats
36
34
  #
37
35
  # @return [undefined]
38
- #
39
- # @api private
40
36
  def print_stats
41
37
  status(
42
38
  FORMAT,
@@ -52,8 +48,6 @@ module Mutant
52
48
  # Print progress bar finish
53
49
  #
54
50
  # @return [undefined]
55
- #
56
- # @api private
57
51
  def print_progress_bar_finish
58
52
  puts(nil) unless amount_mutation_results.zero?
59
53
  end
@@ -61,8 +55,6 @@ module Mutant
61
55
  # Print mutation results
62
56
  #
63
57
  # @return [undefined]
64
- #
65
- # @api private
66
58
  def print_mutation_results
67
59
  visit_collection(MutationProgressResult, object.mutation_results)
68
60
  end
@@ -10,8 +10,6 @@ module Mutant
10
10
  # Run report printer
11
11
  #
12
12
  # @return [undefined]
13
- #
14
- # @api private
15
13
  def run
16
14
  status(subject.identification)
17
15
  tests.each do |test|
@@ -14,8 +14,6 @@ module Mutant
14
14
  # Run test result reporter
15
15
  #
16
16
  # @return [undefined]
17
- #
18
- # @api private
19
17
  def run
20
18
  info(STATUS_FORMAT, tests.length, runtime)
21
19
  tests.each do |test|
@@ -14,8 +14,6 @@ module Mutant
14
14
  #
15
15
  # @return [nil]
16
16
  # otherwise
17
- #
18
- # @api private
19
17
  def self.detect
20
18
  reset = capture('tput reset')
21
19
  save = capture('tput sc') if reset
@@ -34,8 +32,6 @@ module Mutant
34
32
  #
35
33
  # @return [nil]
36
34
  # otherwise
37
- #
38
- # @api private
39
35
  def self.capture(command)
40
36
  stdout, _stderr, exitstatus = Open3.capture3(command)
41
37
  stdout if exitstatus.success?
@@ -12,8 +12,6 @@ module Mutant
12
12
  # @param [Subject] subject
13
13
  #
14
14
  # @return [Boolean]
15
- #
16
- # @api private
17
15
  def call(subject)
18
16
  diff.touches?(subject.source_path, subject.source_lines)
19
17
  end
@@ -22,19 +20,9 @@ module Mutant
22
20
 
23
21
  # Diff between two objects in repository
24
22
  class Diff
25
- include Adamantium, Concord.new(:from, :to)
23
+ include Adamantium, Anima.new(:config, :from, :to)
26
24
 
27
25
  HEAD = 'HEAD'.freeze
28
- private_constant(*constants(false))
29
-
30
- # Create diff from head to revision
31
- #
32
- # @return [Diff]
33
- #
34
- # @api private
35
- def self.from_head(to)
36
- new(HEAD, to)
37
- end
38
26
 
39
27
  # Test if diff changes file at line range
40
28
  #
@@ -45,8 +33,6 @@ module Mutant
45
33
  #
46
34
  # @raise [RepositoryError]
47
35
  # when git command failed
48
- #
49
- # @api private
50
36
  def touches?(path, line_range)
51
37
  return false unless within_working_directory?(path) && tracks?(path)
52
38
 
@@ -56,7 +42,7 @@ module Mutant
56
42
  -L #{line_range.begin},#{line_range.end}:#{path}
57
43
  ]
58
44
 
59
- stdout, status = Open3.capture2(*command, binmode: true)
45
+ stdout, status = config.open3.capture2(*command, binmode: true)
60
46
 
61
47
  fail RepositoryError, "Command #{command} failed!" unless status.success?
62
48
 
@@ -72,11 +58,9 @@ module Mutant
72
58
  # @param [Pathname] path
73
59
  #
74
60
  # @return [Boolean]
75
- #
76
- # @api private
77
61
  def tracks?(path)
78
62
  command = %W[git ls-files --error-unmatch -- #{path}]
79
- Kernel.system(
63
+ config.kernel.system(
80
64
  *command,
81
65
  out: File::NULL,
82
66
  err: File::NULL
@@ -88,10 +72,8 @@ module Mutant
88
72
  # @param [Pathname] path
89
73
  #
90
74
  # @return [TrueClass, nil]
91
- #
92
- # @api private
93
75
  def within_working_directory?(path)
94
- working_directory = Pathname.pwd
76
+ working_directory = config.pathname.pwd
95
77
  path.ascend { |parent| return true if working_directory.eql?(parent) }
96
78
  end
97
79
 
@@ -9,8 +9,6 @@ module Mutant
9
9
  #
10
10
  # @return [#call]
11
11
  # the original implementation on singleton
12
- #
13
- # @api private
14
12
  def self.call(target, callback)
15
13
  target.method(:require).tap do
16
14
  target.module_eval do
@@ -1,5 +1,5 @@
1
1
  module Mutant
2
- # Namespace and mixon module for results
2
+ # Namespace and mixin module for results
3
3
  module Result
4
4
 
5
5
  # Coverage mixin
@@ -10,8 +10,6 @@ module Mutant
10
10
  # Observed coverage
11
11
  #
12
12
  # @return [Rational]
13
- #
14
- # @api private
15
13
  def coverage
16
14
  if amount_mutation_results.zero?
17
15
  FULL_COVERAGE
@@ -33,8 +31,6 @@ module Mutant
33
31
  # the attribute name used to receive collection
34
32
  #
35
33
  # @return [undefined]
36
- #
37
- # @api private
38
34
  def sum(name, collection)
39
35
  define_method(name) do
40
36
  public_send(collection).map(&name).reduce(0, :+)
@@ -48,12 +44,10 @@ module Mutant
48
44
  # Mutant overhead running mutatet tests
49
45
  #
50
46
  # This is NOT the overhead of mutation testing, just an engine specific
51
- # measurement for the efficiency of the parellelization engine, kill
47
+ # measurement for the efficiency of the parallelization engine, kill
52
48
  # isolation etc.
53
49
  #
54
50
  # @return [Float]
55
- #
56
- # @api private
57
51
  def overhead
58
52
  runtime - killtime
59
53
  end
@@ -63,8 +57,6 @@ module Mutant
63
57
  # @param [Class, Module] host
64
58
  #
65
59
  # @return [undefined]
66
- #
67
- # @api private
68
60
  def self.included(host)
69
61
  host.class_eval do
70
62
  include Adamantium
@@ -74,13 +66,15 @@ module Mutant
74
66
 
75
67
  # Env result object
76
68
  class Env
77
- include Coverage, Result, Anima.new(:runtime, :env, :subject_results)
69
+ include Coverage, Result, Anima.new(
70
+ :env,
71
+ :runtime,
72
+ :subject_results
73
+ )
78
74
 
79
75
  # Test if run is successful
80
76
  #
81
77
  # @return [Boolean]
82
- #
83
- # @api private
84
78
  def success?
85
79
  coverage.eql?(env.config.expected_coverage)
86
80
  end
@@ -89,8 +83,6 @@ module Mutant
89
83
  # Failed subject results
90
84
  #
91
85
  # @return [Array<Result::Subject>]
92
- #
93
- # @api private
94
86
  def failed_subject_results
95
87
  subject_results.reject(&:success?)
96
88
  end
@@ -103,8 +95,6 @@ module Mutant
103
95
  # Amount of mutations
104
96
  #
105
97
  # @return [Fixnum]
106
- #
107
- # @api private
108
98
  def amount_mutations
109
99
  env.mutations.length
110
100
  end
@@ -112,8 +102,6 @@ module Mutant
112
102
  # Amount of subjects
113
103
  #
114
104
  # @return [Fixnum]
115
- #
116
- # @api private
117
105
  def amount_subjects
118
106
  env.subjects.length
119
107
  end
@@ -123,16 +111,20 @@ module Mutant
123
111
  # Test result
124
112
  class Test
125
113
  include Result, Anima.new(
126
- :tests,
127
114
  :output,
128
115
  :passed,
129
- :runtime
116
+ :runtime,
117
+ :tests
130
118
  )
131
119
  end # Test
132
120
 
133
121
  # Subject result
134
122
  class Subject
135
- include Coverage, Result, Anima.new(:subject, :tests, :mutation_results)
123
+ include Coverage, Result, Anima.new(
124
+ :mutation_results,
125
+ :subject,
126
+ :tests
127
+ )
136
128
 
137
129
  sum :killtime, :mutation_results
138
130
  sum :runtime, :mutation_results
@@ -140,8 +132,6 @@ module Mutant
140
132
  # Test if subject was processed successful
141
133
  #
142
134
  # @return [Boolean]
143
- #
144
- # @api private
145
135
  def success?
146
136
  alive_mutation_results.empty?
147
137
  end
@@ -149,8 +139,6 @@ module Mutant
149
139
  # Test if runner should continue on subject
150
140
  #
151
141
  # @return [Boolean]
152
- #
153
- # @api private
154
142
  def continue?
155
143
  mutation_results.all?(&:success?)
156
144
  end
@@ -158,8 +146,6 @@ module Mutant
158
146
  # Killed mutations
159
147
  #
160
148
  # @return [Array<Result::Mutation>]
161
- #
162
- # @api private
163
149
  def alive_mutation_results
164
150
  mutation_results.reject(&:success?)
165
151
  end
@@ -168,8 +154,6 @@ module Mutant
168
154
  # Amount of mutations
169
155
  #
170
156
  # @return [Fixnum]
171
- #
172
- # @api private
173
157
  def amount_mutation_results
174
158
  mutation_results.length
175
159
  end
@@ -177,8 +161,6 @@ module Mutant
177
161
  # Amount of mutations
178
162
  #
179
163
  # @return [Fixnum]
180
- #
181
- # @api private
182
164
  def amount_mutations
183
165
  subject.mutations.length
184
166
  end
@@ -186,8 +168,6 @@ module Mutant
186
168
  # Number of killed mutations
187
169
  #
188
170
  # @return [Fixnum]
189
- #
190
- # @api private
191
171
  def amount_mutations_killed
192
172
  killed_mutation_results.length
193
173
  end
@@ -195,8 +175,6 @@ module Mutant
195
175
  # Number of alive mutations
196
176
  #
197
177
  # @return [Fixnum]
198
- #
199
- # @api private
200
178
  def amount_mutations_alive
201
179
  alive_mutation_results.length
202
180
  end
@@ -204,8 +182,6 @@ module Mutant
204
182
  # Alive mutations
205
183
  #
206
184
  # @return [Array<Result::Mutation>]
207
- #
208
- # @api private
209
185
  def killed_mutation_results
210
186
  mutation_results.select(&:success?)
211
187
  end
@@ -215,24 +191,28 @@ module Mutant
215
191
 
216
192
  # Mutation result
217
193
  class Mutation
218
- include Result, Anima.new(:mutation, :test_result)
194
+ include Result, Anima.new(
195
+ :mutation,
196
+ :test_result
197
+ )
219
198
 
220
199
  # The runtime
221
200
  #
222
201
  # @return [Float]
223
- #
224
- # @api private
225
202
  def runtime
226
203
  test_result.runtime
227
204
  end
228
205
 
206
+ # The time spent on killing
207
+ #
208
+ # @return [Float]
209
+ #
210
+ # @api private
229
211
  alias_method :killtime, :runtime
230
212
 
231
213
  # Test if mutation was handled successfully
232
214
  #
233
215
  # @return [Boolean]
234
- #
235
- # @api private
236
216
  def success?
237
217
  mutation.class.success?(test_result)
238
218
  end
@@ -6,8 +6,6 @@ module Mutant
6
6
  # Initialize object
7
7
  #
8
8
  # @return [undefined]
9
- #
10
- # @api private
11
9
  def initialize(*)
12
10
  super
13
11
 
@@ -19,8 +17,6 @@ module Mutant
19
17
  # Final result
20
18
  #
21
19
  # @return [Result::Env]
22
- #
23
- # @api private
24
20
  attr_reader :result
25
21
 
26
22
  private
@@ -28,11 +24,9 @@ module Mutant
28
24
  # Run mutation analysis
29
25
  #
30
26
  # @return [undefined]
31
- #
32
- # @api private
33
27
  def run_mutation_analysis
34
28
  @result = run_driver(Parallel.async(mutation_test_config))
35
- reporter.report(@result)
29
+ reporter.report(result)
36
30
  end
37
31
 
38
32
  # Run driver
@@ -41,16 +35,15 @@ module Mutant
41
35
  #
42
36
  # @return [Object]
43
37
  # the last returned status payload
44
- #
45
- # @api private
46
38
  def run_driver(driver)
47
39
  status = nil
40
+ sleep = env.config.kernel.method(:sleep)
48
41
 
49
42
  loop do
50
43
  status = driver.status
51
44
  reporter.progress(status)
52
45
  break if status.done
53
- Kernel.sleep(reporter.delay)
46
+ sleep.call(reporter.delay)
54
47
  end
55
48
 
56
49
  driver.stop
@@ -58,26 +51,22 @@ module Mutant
58
51
  status.payload
59
52
  end
60
53
 
61
- # Confiugation for paralell execution engine
54
+ # Configuration for parallel execution engine
62
55
  #
63
56
  # @return [Parallel::Config]
64
- #
65
- # @api private
66
57
  def mutation_test_config
67
58
  Parallel::Config.new(
68
59
  env: env.actor_env,
69
60
  jobs: config.jobs,
70
- source: Parallel::Source::Array.new(env.mutations),
71
- sink: Sink::Mutation.new(env),
72
- processor: env.method(:kill)
61
+ processor: env.method(:kill),
62
+ sink: Sink.new(env),
63
+ source: Parallel::Source::Array.new(env.mutations)
73
64
  )
74
65
  end
75
66
 
76
67
  # Reporter to use
77
68
  #
78
69
  # @return [Reporter]
79
- #
80
- # @api private
81
70
  def reporter
82
71
  env.config.reporter
83
72
  end
@@ -85,8 +74,6 @@ module Mutant
85
74
  # Config for this mutant execution
86
75
  #
87
76
  # @return [Config]
88
- #
89
- # @api private
90
77
  def config
91
78
  env.config
92
79
  end