mutant 0.10.27 → 0.10.28

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16a3840650d771f80beec47b664280e386be43b3af1dbc68e369ac738b327476
4
- data.tar.gz: 546c9603de389adce0eb71ec46439900a5e77b8cb2f2cc49553b83a1fba09a39
3
+ metadata.gz: def7afa7fdfc14c0010d8574451d48ae79a782527f80658d0f7eb1fc6c4fd5ec
4
+ data.tar.gz: b64e44cbce5459ef83bf008857c6aefd7b999dd3aaf4b4596779ed04defe79d4
5
5
  SHA512:
6
- metadata.gz: de7d2fd9838eae08548ec13f55734b7f2a6d7537945fc608763b416f735e3383ec23806cbd6a3e982960b1659e07dc63cdd4493314fbc81ba69f4d10f241acba
7
- data.tar.gz: 3b2095127481513dd05efbca7abec9cca8871c5dbb44e55c60c03e69de8c2c7bb3f65fc436e42948f3923aca460e945d926646fb7605ab1a7fe4d4430b155ff4
6
+ metadata.gz: 57830a2931c63d11d625b2543d96db985205478c5ce3282fdbbfa5ae4ba647705e1fe7617b0f2d3d08bbc9bb0f58507ff794f3137d83f4f1cd04faa9bf75ffcc
7
+ data.tar.gz: ff30915a342d8cfb20b192dc36e722cd5f9a601359bd045677df03be92d711476cf1ab105ff588df64adac757ac29a7d87a55b3c5943cc2af31324651e6c7cfd
@@ -8,9 +8,6 @@ module Mutant
8
8
  Adamantium,
9
9
  Concord::Public.new(:scope, :target_method, :evaluator)
10
10
 
11
- # Source locations we cannot acces
12
- BLACKLIST = %w[(eval) <internal:prelude>].to_set.freeze
13
-
14
11
  SOURCE_LOCATION_WARNING_FORMAT =
15
12
  '%s does not have a valid source location, unable to emit subject'
16
13
 
@@ -53,7 +50,10 @@ module Mutant
53
50
 
54
51
  def skip?
55
52
  location = source_location
56
- if location.nil? || BLACKLIST.include?(location.first)
53
+
54
+ file = location&.first
55
+
56
+ if location.nil? || !file.end_with?('.rb')
57
57
  env.warn(SOURCE_LOCATION_WARNING_FORMAT % target_method)
58
58
  elsif matched_node_path.any?(&method(:n_block?))
59
59
  env.warn(CLOSURE_WARNING_FORMAT % target_method)
@@ -28,9 +28,7 @@ module Mutant
28
28
  end
29
29
 
30
30
  def values
31
- original = children.first
32
-
33
- [0.0, 1.0, -original]
31
+ [0.0, 1.0]
34
32
  end
35
33
 
36
34
  end # Float
@@ -9,6 +9,8 @@ module Mutant
9
9
 
10
10
  handle(:int)
11
11
 
12
+ children :value
13
+
12
14
  private
13
15
 
14
16
  def dispatch
@@ -17,12 +19,7 @@ module Mutant
17
19
  end
18
20
 
19
21
  def values
20
- [0, 1, -value, value + 1, value - 1]
21
- end
22
-
23
- def value
24
- value, = children
25
- value
22
+ [0, 1, value + 1, value - 1]
26
23
  end
27
24
 
28
25
  end # Integer
@@ -87,6 +87,7 @@ module Mutant
87
87
  end
88
88
 
89
89
  def emit_selector_specific_mutations
90
+ emit_reduce_to_sum_mutation
90
91
  emit_start_end_with_mutations
91
92
  emit_predicate_mutations
92
93
  emit_array_mutation
@@ -98,6 +99,21 @@ module Mutant
98
99
  emit_lambda_mutation
99
100
  end
100
101
 
102
+ def emit_reduce_to_sum_mutation
103
+ return unless selector.equal?(:reduce)
104
+
105
+ reducer = arguments.last
106
+
107
+ return unless reducer.eql?(s(:sym, :+)) || reducer.eql?(s(:block_pass, s(:sym, :+)))
108
+
109
+ if arguments.length > 1
110
+ initial_value = arguments.first
111
+ emit_type(receiver, :sum, initial_value)
112
+ else
113
+ emit_type(receiver, :sum)
114
+ end
115
+ end
116
+
101
117
  def emit_start_end_with_mutations # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
102
118
  return unless REGEXP_MATCH_METHODS.include?(selector) && arguments.one?
103
119
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # Current mutant version
5
- VERSION = '0.10.27'
5
+ VERSION = '0.10.28'
6
6
  end # Mutant
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.27
4
+ version: 0.10.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-02 00:00:00.000000000 Z
11
+ date: 2021-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs