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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -5
  3. data/.travis.yml +2 -2
  4. data/Changelog.md +8 -0
  5. data/Gemfile.devtools +17 -21
  6. data/config/flay.yml +1 -1
  7. data/config/rubocop.yml +14 -1
  8. data/lib/mutant/cli.rb +2 -2
  9. data/lib/mutant/cli/classifier.rb +1 -1
  10. data/lib/mutant/constants.rb +9 -9
  11. data/lib/mutant/matcher/method.rb +1 -1
  12. data/lib/mutant/matcher/method/singleton.rb +1 -1
  13. data/lib/mutant/matcher/null.rb +1 -1
  14. data/lib/mutant/mutator/node/arguments.rb +1 -1
  15. data/lib/mutant/mutator/node/send.rb +1 -1
  16. data/lib/mutant/reporter/cli/printer.rb +2 -2
  17. data/lib/mutant/reporter/cli/progress.rb +2 -0
  18. data/lib/mutant/reporter/cli/progress/config.rb +8 -6
  19. data/lib/mutant/reporter/cli/progress/mutation.rb +5 -2
  20. data/lib/mutant/reporter/cli/progress/noop.rb +1 -1
  21. data/lib/mutant/reporter/cli/progress/subject.rb +12 -20
  22. data/lib/mutant/reporter/cli/report/config.rb +7 -7
  23. data/lib/mutant/runner.rb +14 -0
  24. data/lib/mutant/runner/config.rb +0 -1
  25. data/lib/mutant/runner/killer.rb +11 -0
  26. data/lib/mutant/runner/mutation.rb +10 -4
  27. data/lib/mutant/runner/subject.rb +0 -2
  28. data/lib/mutant/strategy.rb +0 -2
  29. data/lib/mutant/subject/method/instance.rb +0 -2
  30. data/lib/mutant/version.rb +1 -1
  31. data/lib/mutant/zombifier.rb +3 -3
  32. data/lib/mutant/zombifier/file.rb +1 -1
  33. data/mutant-rspec.gemspec +1 -1
  34. data/spec/integration/mutant/corpus_spec.rb +13 -8
  35. data/spec/integration/mutant/zombie_spec.rb +1 -1
  36. data/spec/unit/mutant/cli_new_spec.rb +10 -10
  37. data/spec/unit/mutant/diff_spec.rb +11 -11
  38. data/spec/unit/mutant/matcher/method/instance_spec.rb +4 -3
  39. data/spec/unit/mutant/matcher/method/singleton_spec.rb +2 -1
  40. data/spec/unit/mutant/mutator/node/literal/boolean_spec.rb +2 -2
  41. data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +1 -1
  42. data/spec/unit/mutant/mutator/node/literal/string_spec.rb +1 -1
  43. data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +1 -1
  44. data/spec/unit/mutant/runner/mutation_spec.rb +19 -17
  45. data/test_app/Gemfile.devtools +17 -21
  46. data/test_app/lib/test_app/literal.rb +1 -1
  47. data/test_app/spec/unit/test_app/literal/command_spec.rb +1 -1
  48. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9eae77be848852158b71548e280781bfb5a4dd55
4
- data.tar.gz: 05c57b8131bbbc16f7284c6528a075f84e8efc21
3
+ metadata.gz: 5ed19319f31c14a3b2677f67cda130f8ae053af1
4
+ data.tar.gz: 6cb628e6e446ed9d1f0c14ad88cfd254d49ee216
5
5
  SHA512:
6
- metadata.gz: 046f7c2d99e04971d914eba1761ef5e469b9fd3f62b1a3c61f1897ff4c5c38d6f851a9f72fc436d2a31418d8d64ef24fd2fcbcf97766d7a02e0be84600a2ed22
7
- data.tar.gz: 87f6eec29d72085a441e1eb678b8287895021ecdfbacdc165b9c867a9d9816fe29a9d738a756bf0cff01fe5b23218eccefd6108db9c264a3bbaeb55ae1eec2e3
6
+ metadata.gz: 482eeee0d39d0e9b869b6a0625d71bf7b08bbdf8acff2fc9f29b44a9b74472cd038e166f053e17323dd41d46295f802245db69d7bb6dc7085336243bc448351b
7
+ data.tar.gz: f332afc9b4404fbcb8ee20e5e74fe6789df531c856d1fc4562d5cb92dee1d771d900405ba044f5360bad39f6400002786584da7f0f4c6efce0be2c5bd4ba5f64
@@ -1,8 +1,8 @@
1
1
  AllCops:
2
- Includes:
2
+ Include:
3
3
  - 'Gemfile'
4
- Excludes:
4
+ Exclude:
5
5
  - 'Gemfile.devtools'
6
- - 'vendor/**'
7
- - 'tmp/**'
8
- - 'benchmarks/**'
6
+ - 'vendor/**/*'
7
+ - 'tmp/**/*'
8
+ - 'benchmarks/**/*'
@@ -6,10 +6,10 @@ rvm:
6
6
  - 1.9.3
7
7
  - 2.0.0
8
8
  - 2.1.1
9
- - rbx
9
+ - rbx-2
10
10
  matrix:
11
11
  allow_failures:
12
- - rvm: rbx
12
+ - rvm: rbx-2
13
13
  notifications:
14
14
  irc:
15
15
  channels:
@@ -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:
@@ -1,34 +1,30 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  group :development do
4
- gem 'rake', '~> 10.1.0'
5
- gem 'rspec', '~> 2.14.1'
6
- gem 'rspec-core', '~> 2.14.8'
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.4.0'
15
+ gem 'guard', '~> 2.6.0'
20
16
  gem 'guard-bundler', '~> 2.0.0'
21
- gem 'guard-rspec', '~> 4.2.6'
22
- gem 'guard-rubocop', '~> 1.0.2'
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.5.0'
21
+ gem 'listen', '~> 2.7.3'
26
22
  gem 'rb-fchange', '~> 0.0.6', require: false
27
- gem 'rb-fsevent', '~> 0.9.3', require: false
28
- gem 'rb-inotify', '~> 0.9.0', require: false
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.0', require: false
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.2'
41
- gem 'rubocop', '~> 0.18.1'
42
- gem 'simplecov', '~> 0.8.2'
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.2'
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.8.5'
60
+ gem 'jruby-openssl', '~> 0.9.4'
65
61
  end
66
62
  end
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 18
3
- total_score: 794
3
+ total_score: 801
@@ -7,7 +7,7 @@ inherit_from: ../.rubocop.yml
7
7
 
8
8
 
9
9
  AllCops:
10
- Includes:
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
@@ -285,7 +285,7 @@ module Mutant
285
285
  # @api private
286
286
  #
287
287
  def use(name)
288
- require "mutant-#{name}"
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 |name|
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
@@ -132,7 +132,7 @@ module Mutant
132
132
  # @api private
133
133
  #
134
134
  abstract_method :matcher
135
- private :matcher
135
+ private :matcher
136
136
 
137
137
  end # Classifier
138
138
  end # CLI
@@ -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(int float str dstr class module self))
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(or_asgn and_asgn op_asgn))
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( splat restarg block_pass))
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(not))
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(empty))
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
 
@@ -46,7 +46,7 @@ module Mutant
46
46
  def skip?
47
47
  location = source_location
48
48
  if location.nil? || BLACKLIST.match(location.first)
49
- message = sprintf(
49
+ message = format(
50
50
  '%s does not have valid source location unable to emit matcher',
51
51
  method.inspect
52
52
  )
@@ -94,7 +94,7 @@ module Mutant
94
94
  when :const
95
95
  receiver_name?(receiver)
96
96
  else
97
- message = sprintf(
97
+ message = format(
98
98
  'Can only match :defs on :self or :const got %s unable to match',
99
99
  receiver.type.inspect
100
100
  )
@@ -16,7 +16,7 @@ module Mutant
16
16
  #
17
17
  # @api private
18
18
  #
19
- def each(&block)
19
+ def each
20
20
  return to_enum unless block_given?
21
21
  self
22
22
  end
@@ -43,7 +43,7 @@ module Mutant
43
43
  # @api private
44
44
  #
45
45
  def mlhs_childs_with_index
46
- children.each_with_index.select do |child, index|
46
+ children.each_with_index.select do |child, _index|
47
47
  child.type == :mlhs
48
48
  end
49
49
  end
@@ -145,7 +145,7 @@ module Mutant
145
145
  #
146
146
  def mutate_arguments
147
147
  emit_self(receiver, selector)
148
- remaining_children_with_index.each do |node, index|
148
+ remaining_children_with_index.each do |_node, index|
149
149
  mutate_child(index)
150
150
  delete_child(index)
151
151
  end
@@ -60,7 +60,7 @@ module Mutant
60
60
  # @api private
61
61
  #
62
62
  def info(string, *arguments)
63
- puts(sprintf(string, *arguments))
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, sprintf(string, *arguments)))
73
+ puts(colorize(status_color, format(string, *arguments)))
74
74
  end
75
75
 
76
76
  # Print a line to output
@@ -6,6 +6,8 @@ module Mutant
6
6
  # Abstract base class for process printers
7
7
  class Progress < Printer
8
8
  include AbstractType, Registry.new
9
+
10
+ delegate :running?
9
11
  end # Progress
10
12
  end # CLI
11
13
  end # Reporter
@@ -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 :matcher, :strategy, :expected_coverage
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
- info 'Mutant configuration:'
22
- info 'Matcher: %s', matcher.inspect
23
- info 'Strategy: %s', strategy.inspect
24
- info 'Expect Coverage: %02f%%', expected_coverage.inspect
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 [undefined]
16
+ # @return [self]
17
17
  #
18
18
  # @api private
19
19
  #
20
20
  def run
21
- char(success? ? SUCCESS : FAILURE)
21
+ unless running?
22
+ char(success? ? SUCCESS : FAILURE)
23
+ end
24
+ self
22
25
  end
23
26
 
24
27
  private
@@ -5,7 +5,7 @@ module Mutant
5
5
  # Noop CLI progress reporter
6
6
  class Noop < self
7
7
 
8
- handle(Mutant::Mutation)
8
+ handle(Mutant::Runner::Killer)
9
9
 
10
10
  # Noop progress report
11
11
  #
@@ -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 SubjectRunner < self
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
- print_progress_bar_finish
37
- print_stats
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 '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
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
@@ -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
 
@@ -134,7 +134,6 @@ module Mutant
134
134
  # @api private
135
135
  #
136
136
  def run
137
- progress(config)
138
137
  run_subjects
139
138
  @end = Time.now
140
139
  reporter.report(self)
@@ -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
- progress(mutation)
67
- @killers = @tests.map do |test|
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.map(&method(:visit))
73
- progress(self)
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
@@ -83,9 +83,7 @@ module Mutant
83
83
  # @api private
84
84
  #
85
85
  def run
86
- progress(subject)
87
86
  @mutations = visit_collection(subject.mutations, tests)
88
- progress(self)
89
87
  end
90
88
 
91
89
  end # Subject
@@ -83,8 +83,6 @@ module Mutant
83
83
  []
84
84
  end
85
85
 
86
- private
87
-
88
86
  # Null strategy that never kills a mutation
89
87
  class Null < self
90
88
 
@@ -43,8 +43,6 @@ module Mutant
43
43
  self
44
44
  end
45
45
 
46
- private
47
-
48
46
  # Mutator for memoized instance methods
49
47
  class Memoized < self
50
48
  include NodeHelpers
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # The current mutant version
5
- VERSION = '0.5.16'.freeze
5
+ VERSION = '0.5.17'.freeze
6
6
  end # Mutant
@@ -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(\A#{Regexp.union(includes)}(?:/.*)?\z).freeze
18
+ INCLUDES = %r{\A#{Regexp.union(includes)}(?:/.*)?\z}.freeze
19
19
 
20
20
  # Initialize object
21
21
  #
@@ -11,7 +11,7 @@ module Mutant
11
11
  # @api private
12
12
  #
13
13
  def zombify(namespace)
14
- $stderr.puts("Zombifying #{path.to_s}")
14
+ $stderr.puts("Zombifying #{path}")
15
15
  eval(
16
16
  Unparser.unparse(namespaced_node(namespace)),
17
17
  TOPLEVEL_BINDING,
@@ -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{-,/}rspec.rb lib/mutant/rspec`.split("\n")
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.to_s}"
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 |mutant|
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 "Total Mutations/Time/Parse-Errors: %s/%0.2fs/%i - %0.2f/s" % [
53
- total, took, parse_errors.size, total / took
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(git pull origin master))
73
- system(%w(git clean -f -d -x))
77
+ system(%w[git pull origin master])
78
+ system(%w[git clean -f -d -x])
74
79
  end
75
80
  else
76
- system(%W(git clone #{repo_uri} #{repo_path}))
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 { !!defined?(Zombie) }.from(false).to(true)
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 eql(expected_matcher) }
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(--invalid) }
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(--invalid Foo) }
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(--code) }
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(TestApp::Literal#float) }
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(--debug #{pattern}) }
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(--zombie #{pattern}) }
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) { %W(#{pattern}) }
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(--code faa --code bbb #{pattern}) }
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(foo bar), %w(bar baz))) }
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(foo bar) }
50
- let(:new) { %w(baz bar) }
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(foo bar) }
68
- let(:new) { %w(foo baz bar) }
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(foo bar baz boz a b c) }
86
- let(:new) { %w(foo bar baz boz a b c other) }
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(other foo bar baz boz a b c) }
109
- let(:new) { %w(foo bar baz boz a b c) }
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(foo bar baz boz a b c) }
132
- let(:new) { %w(other foo bar baz boz a b c) }
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(arg)
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(arg); end
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(arg); end
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(arg)
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(nil false)
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(nil true)
20
+ %w[nil true]
21
21
  end
22
22
 
23
23
  it_should_behave_like 'a mutator'
@@ -6,7 +6,7 @@ describe Mutant::Mutator::Node::Literal, 'fixnum' do
6
6
  let(:source) { '10' }
7
7
 
8
8
  let(:mutations) do
9
- %W(nil 0 1 -10 9 11)
9
+ %w[nil 0 1 -10 9 11]
10
10
  end
11
11
 
12
12
  it_should_behave_like 'a mutator'
@@ -8,7 +8,7 @@ describe Mutant::Mutator::Node::Literal, 'string' do
8
8
  let(:source) { '"foo"' }
9
9
 
10
10
  let(:mutations) do
11
- %W(nil)
11
+ %w[nil]
12
12
  end
13
13
 
14
14
  it_should_behave_like 'a mutator'
@@ -8,7 +8,7 @@ describe Mutant::Mutator::Node::Literal, 'symbol' do
8
8
  let(:source) { ':foo' }
9
9
 
10
10
  let(:mutations) do
11
- %w(nil) << ':foo__mutant__'
11
+ %w[nil :foo__mutant__]
12
12
  end
13
13
 
14
14
  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(:test_a) { double('test a') }
23
- let(:test_b) { double('test b') }
24
- let(:tests) { [test_a, test_b] }
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)
@@ -1,34 +1,30 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  group :development do
4
- gem 'rake', '~> 10.1.0'
5
- gem 'rspec', '~> 2.14.1'
6
- gem 'rspec-core', '~> 2.14.8'
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.4.0'
15
+ gem 'guard', '~> 2.6.0'
20
16
  gem 'guard-bundler', '~> 2.0.0'
21
- gem 'guard-rspec', '~> 4.2.6'
22
- gem 'guard-rubocop', '~> 1.0.2'
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.5.0'
21
+ gem 'listen', '~> 2.7.3'
26
22
  gem 'rb-fchange', '~> 0.0.6', require: false
27
- gem 'rb-fsevent', '~> 0.9.3', require: false
28
- gem 'rb-inotify', '~> 0.9.0', require: false
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.0', require: false
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.2'
41
- gem 'rubocop', '~> 0.18.1'
42
- gem 'simplecov', '~> 0.8.2'
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.2'
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.8.5'
60
+ gem 'jruby-openssl', '~> 0.9.4'
65
61
  end
66
62
  end
@@ -7,7 +7,7 @@ module TestApp
7
7
  true
8
8
  end
9
9
 
10
- def command(foo)
10
+ def command(_foo)
11
11
  self
12
12
  end
13
13
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe TestApp::Literal, '#string' do
5
+ RSpec.describe TestApp::Literal, '#command' do
6
6
  subject { object.command(double) }
7
7
 
8
8
  let(:object) { described_class.new }
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.5.16
4
+ version: 0.5.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp