mutant 0.5.17 → 0.5.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +6 -0
  3. data/Rakefile +13 -0
  4. data/config/flay.yml +1 -1
  5. data/config/reek.yml +8 -1
  6. data/lib/mutant.rb +18 -3
  7. data/lib/mutant/cli.rb +6 -3
  8. data/lib/mutant/constants.rb +3 -0
  9. data/lib/mutant/expression.rb +110 -0
  10. data/lib/mutant/expression/method.rb +92 -0
  11. data/lib/mutant/expression/namespace.rb +90 -0
  12. data/lib/mutant/matcher/namespace.rb +3 -4
  13. data/lib/mutant/meta.rb +31 -0
  14. data/lib/mutant/meta/example.rb +152 -0
  15. data/lib/mutant/meta/example/dsl.rb +105 -0
  16. data/lib/mutant/mutator/node.rb +6 -6
  17. data/lib/mutant/mutator/node/arguments.rb +1 -1
  18. data/lib/mutant/mutator/node/begin.rb +1 -1
  19. data/lib/mutant/mutator/node/const.rb +1 -1
  20. data/lib/mutant/mutator/node/if.rb +6 -6
  21. data/lib/mutant/mutator/node/literal/array.rb +2 -2
  22. data/lib/mutant/mutator/node/literal/hash.rb +2 -2
  23. data/lib/mutant/mutator/node/literal/range.rb +3 -3
  24. data/lib/mutant/mutator/node/literal/regex.rb +2 -2
  25. data/lib/mutant/mutator/node/literal/symbol.rb +1 -1
  26. data/lib/mutant/mutator/node/op_asgn.rb +1 -3
  27. data/lib/mutant/mutator/node/or_asgn.rb +31 -0
  28. data/lib/mutant/mutator/node/send.rb +1 -1
  29. data/lib/mutant/mutator/node/send/attribute_assignment.rb +1 -1
  30. data/lib/mutant/reporter/cli/report/mutation.rb +11 -1
  31. data/lib/mutant/strategy.rb +1 -1
  32. data/lib/mutant/version.rb +1 -1
  33. data/meta/and.rb +12 -0
  34. data/meta/and_asgn.rb +12 -0
  35. data/meta/array.rb +30 -0
  36. data/meta/begin.rb +15 -0
  37. data/meta/binary.rb +12 -0
  38. data/meta/block.rb +55 -0
  39. data/meta/block_pass.rb +8 -0
  40. data/meta/blockarg.rb +10 -0
  41. data/meta/boolean.rb +15 -0
  42. data/meta/break.rb +11 -0
  43. data/meta/case.rb +303 -0
  44. data/meta/casgn.rb +9 -0
  45. data/meta/cbase.rb +8 -0
  46. data/meta/const.rb +9 -0
  47. data/meta/cvar.rb +7 -0
  48. data/meta/cvasgn.rb +10 -0
  49. data/meta/define.rb +118 -0
  50. data/meta/defined.rb +7 -0
  51. data/meta/dstr.rb +10 -0
  52. data/meta/dsym.rb +11 -0
  53. data/meta/ensure.rb +9 -0
  54. data/meta/fixnum.rb +19 -0
  55. data/meta/float.rb +38 -0
  56. data/meta/gvar.rb +7 -0
  57. data/meta/gvasgn.rb +10 -0
  58. data/meta/hash.rb +25 -0
  59. data/meta/if.rb +57 -0
  60. data/meta/ivasgn.rb +10 -0
  61. data/meta/kwbegin.rb +9 -0
  62. data/meta/lvar.rb +14 -0
  63. data/meta/lvasgn.rb +10 -0
  64. data/meta/masgn.rb +7 -0
  65. data/meta/match_current_line.rb +14 -0
  66. data/meta/next.rb +11 -0
  67. data/meta/nil.rb +5 -0
  68. data/meta/nthref.rb +14 -0
  69. data/meta/op_assgn.rb +15 -0
  70. data/meta/or_asgn.rb +22 -0
  71. data/meta/range.rb +41 -0
  72. data/meta/redo.rb +5 -0
  73. data/meta/regex.rb +20 -0
  74. data/meta/rescue.rb +38 -0
  75. data/meta/restarg.rb +11 -0
  76. data/meta/return.rb +15 -0
  77. data/meta/self.rb +7 -0
  78. data/meta/send.rb +240 -0
  79. data/meta/string.rb +7 -0
  80. data/meta/super.rb +26 -0
  81. data/meta/symbol.rb +8 -0
  82. data/meta/unless.rb +15 -0
  83. data/meta/while.rb +24 -0
  84. data/meta/yield.rb +10 -0
  85. data/mutant.gemspec +1 -0
  86. data/spec/integration/mutant/corpus_spec.rb +29 -25
  87. data/spec/spec_helper.rb +2 -0
  88. data/spec/support/mutation_verifier.rb +1 -0
  89. data/spec/unit/mutant/cli_new_spec.rb +6 -6
  90. data/spec/unit/mutant/expression/method_spec.rb +50 -0
  91. data/spec/unit/mutant/expression/namespace/flat_spec.rb +32 -0
  92. data/spec/unit/mutant/expression/namespace/recursive_spec.rb +37 -0
  93. data/spec/unit/mutant/matcher/namespace_spec.rb +2 -2
  94. data/spec/unit/mutant/mutation_spec.rb +1 -1
  95. data/spec/unit/mutant/mutator/node_spec.rb +14 -0
  96. metadata +123 -139
  97. data/lib/mutant/cli/classifier.rb +0 -139
  98. data/lib/mutant/cli/classifier/method.rb +0 -105
  99. data/lib/mutant/cli/classifier/namespace.rb +0 -49
  100. data/spec/unit/mutant/cli/classifier/method_spec.rb +0 -77
  101. data/spec/unit/mutant/cli/classifier/namespace/flat_spec.rb +0 -58
  102. data/spec/unit/mutant/cli/classifier/namespace/recursive_spec.rb +0 -58
  103. data/spec/unit/mutant/cli/classifier_spec.rb +0 -59
  104. data/spec/unit/mutant/mutator/node/and_asgn_spec.rb +0 -19
  105. data/spec/unit/mutant/mutator/node/begin_spec.rb +0 -32
  106. data/spec/unit/mutant/mutator/node/binary_spec.rb +0 -41
  107. data/spec/unit/mutant/mutator/node/block_pass_spec.rb +0 -15
  108. data/spec/unit/mutant/mutator/node/block_spec.rb +0 -83
  109. data/spec/unit/mutant/mutator/node/blockarg_spec.rb +0 -17
  110. data/spec/unit/mutant/mutator/node/case_spec.rb +0 -329
  111. data/spec/unit/mutant/mutator/node/cbase_spec.rb +0 -15
  112. data/spec/unit/mutant/mutator/node/conditional_loop_spec.rb +0 -58
  113. data/spec/unit/mutant/mutator/node/const_spec.rb +0 -16
  114. data/spec/unit/mutant/mutator/node/define_spec.rb +0 -171
  115. data/spec/unit/mutant/mutator/node/defined_spec.rb +0 -14
  116. data/spec/unit/mutant/mutator/node/dstr_spec.rb +0 -17
  117. data/spec/unit/mutant/mutator/node/dsym_spec.rb +0 -18
  118. data/spec/unit/mutant/mutator/node/ensure_spec.rb +0 -16
  119. data/spec/unit/mutant/mutator/node/if_spec.rb +0 -77
  120. data/spec/unit/mutant/mutator/node/kwbegin_spec.rb +0 -16
  121. data/spec/unit/mutant/mutator/node/literal/array_spec.rb +0 -47
  122. data/spec/unit/mutant/mutator/node/literal/boolean_spec.rb +0 -25
  123. data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +0 -13
  124. data/spec/unit/mutant/mutator/node/literal/float_spec.rb +0 -53
  125. data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +0 -33
  126. data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +0 -10
  127. data/spec/unit/mutant/mutator/node/literal/range_spec.rb +0 -56
  128. data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +0 -36
  129. data/spec/unit/mutant/mutator/node/literal/string_spec.rb +0 -15
  130. data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +0 -15
  131. data/spec/unit/mutant/mutator/node/loop_ctrl_spec.rb +0 -37
  132. data/spec/unit/mutant/mutator/node/masgn_spec.rb +0 -14
  133. data/spec/unit/mutant/mutator/node/match_current_line_spec.rb +0 -21
  134. data/spec/unit/mutant/mutator/node/named_value/access_spec.rb +0 -78
  135. data/spec/unit/mutant/mutator/node/named_value/constant_assignment_spec.rb +0 -16
  136. data/spec/unit/mutant/mutator/node/named_value/variable_assignment_spec.rb +0 -61
  137. data/spec/unit/mutant/mutator/node/nthref_spec.rb +0 -19
  138. data/spec/unit/mutant/mutator/node/op_assgn_spec.rb +0 -22
  139. data/spec/unit/mutant/mutator/node/or_asgn_spec.rb +0 -19
  140. data/spec/unit/mutant/mutator/node/redo_spec.rb +0 -10
  141. data/spec/unit/mutant/mutator/node/rescue_spec.rb +0 -63
  142. data/spec/unit/mutant/mutator/node/restarg_spec.rb +0 -18
  143. data/spec/unit/mutant/mutator/node/return_spec.rb +0 -31
  144. data/spec/unit/mutant/mutator/node/send_spec.rb +0 -382
  145. data/spec/unit/mutant/mutator/node/super_spec.rb +0 -46
  146. data/spec/unit/mutant/mutator/node/yield_spec.rb +0 -17
@@ -19,7 +19,7 @@ module Mutant
19
19
  #
20
20
  def dispatch
21
21
  emit_nil
22
- emit_self
22
+ emit_type
23
23
  mutate_body
24
24
  end
25
25
 
@@ -34,7 +34,7 @@ module Mutant
34
34
  mutate_child(index)
35
35
  dup_children = children.dup
36
36
  dup_children.delete_at(index)
37
- emit_self(*dup_children)
37
+ emit_type(*dup_children)
38
38
  end
39
39
  end
40
40
 
@@ -50,7 +50,7 @@ module Mutant
50
50
  #
51
51
  def emit_upper_bound_mutations
52
52
  emit__end_mutations
53
- emit_self(NAN, _end)
53
+ emit_type(NAN, _end)
54
54
  end
55
55
 
56
56
  # Emit start mutations
@@ -61,8 +61,8 @@ module Mutant
61
61
  #
62
62
  def emit_lower_bound_mutations
63
63
  emit_start_mutations
64
- emit_self(start, INFINITY)
65
- emit_self(start, NAN)
64
+ emit_type(start, INFINITY)
65
+ emit_type(start, NAN)
66
66
  end
67
67
 
68
68
  end # Range
@@ -35,8 +35,8 @@ module Mutant
35
35
  children.each_with_index do |child, index|
36
36
  mutate_child(index) unless child.type == :str
37
37
  end
38
- emit_self(options)
39
- emit_self(s(:str, NULL_REGEXP_SOURCE), options)
38
+ emit_type(options)
39
+ emit_type(s(:str, NULL_REGEXP_SOURCE), options)
40
40
  end
41
41
 
42
42
  end # Regex
@@ -24,7 +24,7 @@ module Mutant
24
24
  def dispatch
25
25
  emit_nil
26
26
  Mutator::Util::Symbol.each(value, self) do |value|
27
- emit_self(value)
27
+ emit_type(value)
28
28
  end
29
29
  end
30
30
 
@@ -7,9 +7,7 @@ module Mutant
7
7
  # OpAsgn mutator
8
8
  class OpAsgn < Generic
9
9
 
10
- handle(:op_asgn, :or_asgn, :and_asgn)
11
-
12
- children :left, :right
10
+ handle(:op_asgn, :and_asgn)
13
11
 
14
12
  private
15
13
 
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ module Mutant
4
+ class Mutator
5
+ class Node
6
+
7
+ # OpAsgn mutator
8
+ class OrAsgn < self
9
+
10
+ handle(:or_asgn)
11
+
12
+ children :left, :right
13
+
14
+ private
15
+
16
+ # Emit mutations
17
+ #
18
+ # @return [undefined]
19
+ #
20
+ # @api private
21
+ #
22
+ def dispatch
23
+ emit_nil
24
+ emit_left_mutations unless left.type.equal?(:ivasgn)
25
+ emit_right_mutations
26
+ end
27
+
28
+ end # OrAsgn
29
+ end # Node
30
+ end # Mutator
31
+ end # Mutant
@@ -144,7 +144,7 @@ module Mutant
144
144
  # @api private
145
145
  #
146
146
  def mutate_arguments
147
- emit_self(receiver, selector)
147
+ emit_type(receiver, selector)
148
148
  remaining_children_with_index.each do |_node, index|
149
149
  mutate_child(index)
150
150
  delete_child(index)
@@ -40,7 +40,7 @@ module Mutant
40
40
  # @api private
41
41
  #
42
42
  def emit_attribute_read
43
- emit_self(receiver, selector.to_s[0..-2].to_sym)
43
+ emit_type(receiver, selector.to_s[0..-2].to_sym)
44
44
  end
45
45
 
46
46
  end # AttributeAssignment
@@ -99,12 +99,22 @@ module Mutant
99
99
  #
100
100
  def report_noop
101
101
  info('NOOP MUTATION TESTS FAILED!')
102
- killers.reject(&:success?).map(&:report).map(&:test_report).each do |report|
102
+ noop_reports.each do |report|
103
103
  puts(report.test.identification)
104
104
  puts(report.output)
105
105
  end
106
106
  end
107
107
 
108
+ # Return test noop reports
109
+ #
110
+ # @return [Enumerable<Test::Report>]
111
+ #
112
+ # @api private
113
+ #
114
+ def noop_reports
115
+ killers.reject(&:success?).map(&:report).map(&:test_report)
116
+ end
117
+
108
118
  end # Mutation
109
119
  end # Report
110
120
  end # CLI
@@ -80,7 +80,7 @@ module Mutant
80
80
  return tests if tests.any?
81
81
  end
82
82
 
83
- []
83
+ EMPTY_ARRAY
84
84
  end
85
85
 
86
86
  # Null strategy that never kills a mutation
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # The current mutant version
5
- VERSION = '0.5.17'.freeze
5
+ VERSION = '0.5.18'.freeze
6
6
  end # Mutant
data/meta/and.rb ADDED
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'true and false'
5
+
6
+ mutation 'nil'
7
+ mutation 'true'
8
+ mutation 'false'
9
+ mutation 'true or false'
10
+ mutation '!true and false'
11
+ mutation '!(true and false)'
12
+ end
data/meta/and_asgn.rb ADDED
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'a &&= 1'
5
+
6
+ mutation 'a__mutant__ &&= 1'
7
+ mutation 'a &&= nil'
8
+ mutation 'a &&= 0'
9
+ mutation 'a &&= -1'
10
+ mutation 'a &&= 2'
11
+ mutation 'nil'
12
+ end
data/meta/array.rb ADDED
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source '[true]'
5
+
6
+ mutation 'nil'
7
+ mutation 'true'
8
+ mutation '[false]'
9
+ mutation '[nil]'
10
+ mutation '[]'
11
+ end
12
+
13
+ Mutant::Meta::Example.add do
14
+ source '[true, false]'
15
+
16
+ mutation 'nil'
17
+
18
+ # Mutation of each element in array
19
+ mutation '[nil, false]'
20
+ mutation '[false, false]'
21
+ mutation '[true, nil]'
22
+ mutation '[true, true]'
23
+
24
+ # Remove each element of array once
25
+ mutation '[true]'
26
+ mutation '[false]'
27
+
28
+ # Empty array
29
+ mutation '[]'
30
+ end
data/meta/begin.rb ADDED
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+
5
+ source 'true; false'
6
+ # Mutation of each statement in block
7
+ mutation 'true; true'
8
+ mutation 'false; false'
9
+ mutation 'nil; false'
10
+ mutation 'true; nil'
11
+
12
+ # Delete each statement
13
+ mutation 'true'
14
+ mutation 'false'
15
+ end
data/meta/binary.rb ADDED
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'true or false'
5
+
6
+ mutation 'nil'
7
+ mutation 'true'
8
+ mutation 'false'
9
+ mutation 'true and false'
10
+ mutation '!true or false'
11
+ mutation '!(true or false)'
12
+ end
data/meta/block.rb ADDED
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'foo() { a; b }'
5
+
6
+ mutation 'foo { a }'
7
+ mutation 'foo { b }'
8
+ mutation 'foo {}'
9
+ mutation 'foo { raise }'
10
+ mutation 'foo { a; nil }'
11
+ mutation 'foo { nil; b }'
12
+ mutation 'foo'
13
+ mutation 'nil'
14
+ end
15
+
16
+ Mutant::Meta::Example.add do
17
+ source 'foo { |a, b| }'
18
+
19
+ mutation 'foo'
20
+ mutation 'foo { |a, b| raise }'
21
+ mutation 'foo { |a, b__mutant__| }'
22
+ mutation 'foo { |a__mutant__, b| }'
23
+ mutation 'foo { |a| }'
24
+ mutation 'foo { |b| }'
25
+ mutation 'foo { || }'
26
+ mutation 'nil'
27
+ end
28
+
29
+ Mutant::Meta::Example.add do
30
+ source 'foo { |(a, b), c| }'
31
+
32
+ mutation 'nil'
33
+ mutation 'foo { || }'
34
+ mutation 'foo { |a, b, c| }'
35
+ mutation 'foo { |(a, b), c| raise }'
36
+ mutation 'foo { |(a), c| }'
37
+ mutation 'foo { |(b), c| }'
38
+ mutation 'foo { |(a, b)| }'
39
+ mutation 'foo { |c| }'
40
+ mutation 'foo { |(a__mutant__, b), c| }'
41
+ mutation 'foo { |(a, b__mutant__), c| }'
42
+ mutation 'foo { |(a, b), c__mutant__| }'
43
+ mutation 'foo'
44
+ end
45
+
46
+ Mutant::Meta::Example.add do
47
+ source 'foo { |(a)| }'
48
+
49
+ mutation 'foo { || }'
50
+ mutation 'foo { |a| }'
51
+ mutation 'foo { |(a)| raise }'
52
+ mutation 'foo { |(a__mutant__)| }'
53
+ mutation 'foo'
54
+ mutation 'nil'
55
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'foo(&bar)'
5
+
6
+ mutation 'foo'
7
+ mutation 'nil'
8
+ end
data/meta/blockarg.rb ADDED
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'foo { |&bar| }'
5
+
6
+ mutation 'foo { |&bar| raise }'
7
+ mutation 'foo {}'
8
+ mutation 'foo'
9
+ mutation 'nil'
10
+ end
data/meta/boolean.rb ADDED
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'true'
5
+
6
+ mutation 'nil'
7
+ mutation 'false'
8
+ end
9
+
10
+ Mutant::Meta::Example.add do
11
+ source 'false'
12
+
13
+ mutation 'nil'
14
+ mutation 'true'
15
+ end
data/meta/break.rb ADDED
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source 'break true'
5
+
6
+ mutation 'break false'
7
+ mutation 'break nil'
8
+ mutation 'break'
9
+ mutation 'nil'
10
+ mutation 'next true'
11
+ end
data/meta/case.rb ADDED
@@ -0,0 +1,303 @@
1
+ # encoding: utf-8
2
+
3
+ Mutant::Meta::Example.add do
4
+ source <<-RUBY
5
+ case
6
+ when true
7
+ else
8
+ end
9
+ RUBY
10
+
11
+ mutation 'nil'
12
+
13
+ mutation <<-RUBY
14
+ case
15
+ when true
16
+ raise
17
+ else
18
+ end
19
+ RUBY
20
+ mutation <<-RUBY
21
+ case
22
+ when false
23
+ else
24
+ end
25
+ RUBY
26
+ mutation <<-RUBY
27
+ case
28
+ when nil
29
+ else
30
+ end
31
+ RUBY
32
+ end
33
+
34
+ Mutant::Meta::Example.add do
35
+ source <<-RUBY
36
+ case :condition
37
+ when :foo
38
+ when :bar, :baz
39
+ :barbaz
40
+ else
41
+ :else
42
+ end
43
+ RUBY
44
+
45
+ # Presence of branches
46
+ mutation <<-RUBY
47
+ case :condition
48
+ when :bar, :baz
49
+ :barbaz
50
+ else
51
+ :else
52
+ end
53
+ RUBY
54
+ mutation <<-RUBY
55
+ case :condition
56
+ when :foo
57
+ else
58
+ :else
59
+ end
60
+ RUBY
61
+ mutation <<-RUBY
62
+ case :condition
63
+ when :foo
64
+ when :bar, :baz
65
+ :barbaz
66
+ end
67
+ RUBY
68
+
69
+ # Mutations of condition
70
+ mutation <<-RUBY
71
+ case nil
72
+ when :foo
73
+ when :bar, :baz
74
+ :barbaz
75
+ else
76
+ :else
77
+ end
78
+ RUBY
79
+ mutation <<-RUBY
80
+ case :condition__mutant__
81
+ when :foo
82
+ when :bar, :baz
83
+ :barbaz
84
+ else
85
+ :else
86
+ end
87
+ RUBY
88
+
89
+ # Mutations of branch bodies
90
+ mutation <<-RUBY
91
+ case :condition
92
+ when :foo
93
+ raise
94
+ when :bar, :baz
95
+ :barbaz
96
+ else
97
+ :else
98
+ end
99
+ RUBY
100
+ mutation <<-RUBY
101
+ case :condition
102
+ when :foo
103
+ when :bar, :baz
104
+ :barbaz__mutant__
105
+ else
106
+ :else
107
+ end
108
+ RUBY
109
+ mutation <<-RUBY
110
+ case :condition
111
+ when :foo
112
+ when :bar, :baz
113
+ nil
114
+ else
115
+ :else
116
+ end
117
+ RUBY
118
+ mutation <<-RUBY
119
+ case :condition
120
+ when :foo
121
+ when :bar, :baz
122
+ :barbaz
123
+ else
124
+ :else__mutant__
125
+ end
126
+ RUBY
127
+ mutation <<-RUBY
128
+ case :condition
129
+ when :foo
130
+ when :bar, :baz
131
+ :barbaz
132
+ else
133
+ nil
134
+ end
135
+ RUBY
136
+
137
+ # Mutations of when conditions
138
+ mutation <<-RUBY
139
+ case :condition
140
+ when :foo__mutant__
141
+ when :bar, :baz
142
+ :barbaz
143
+ else
144
+ :else
145
+ end
146
+ RUBY
147
+ mutation <<-RUBY
148
+ case :condition
149
+ when nil
150
+ when :bar, :baz
151
+ :barbaz
152
+ else
153
+ :else
154
+ end
155
+ RUBY
156
+ mutation <<-RUBY
157
+ case :condition
158
+ when :foo
159
+ when :bar__mutant__, :baz
160
+ :barbaz
161
+ else
162
+ :else
163
+ end
164
+ RUBY
165
+ mutation <<-RUBY
166
+ case :condition
167
+ when :foo
168
+ when nil, :baz
169
+ :barbaz
170
+ else
171
+ :else
172
+ end
173
+ RUBY
174
+ mutation <<-RUBY
175
+ case :condition
176
+ when :foo
177
+ when :bar, nil
178
+ :barbaz
179
+ else
180
+ :else
181
+ end
182
+ RUBY
183
+ mutation <<-RUBY
184
+ case :condition
185
+ when :foo
186
+ when :bar, :baz__mutant__
187
+ :barbaz
188
+ else
189
+ :else
190
+ end
191
+ RUBY
192
+ mutation <<-RUBY
193
+ case :condition
194
+ when :foo
195
+ when :baz
196
+ :barbaz
197
+ else
198
+ :else
199
+ end
200
+ RUBY
201
+ mutation <<-RUBY
202
+ case :condition
203
+ when :foo
204
+ when :bar
205
+ :barbaz
206
+ else
207
+ :else
208
+ end
209
+ RUBY
210
+
211
+ mutation 'nil'
212
+ end
213
+
214
+ Mutant::Meta::Example.add do
215
+ source <<-RUBY
216
+ case :condition
217
+ when :foo
218
+ :foo
219
+ else
220
+ :else
221
+ end
222
+ RUBY
223
+
224
+ # Presence of branches
225
+ mutation <<-RUBY
226
+ case :condition
227
+ when :foo
228
+ :foo
229
+ end
230
+ RUBY
231
+
232
+ # Mutations of condition
233
+ mutation <<-RUBY
234
+ case nil
235
+ when :foo
236
+ :foo
237
+ else
238
+ :else
239
+ end
240
+ RUBY
241
+ mutation <<-RUBY
242
+ case :condition__mutant__
243
+ when :foo
244
+ :foo
245
+ else
246
+ :else
247
+ end
248
+ RUBY
249
+
250
+ # Mutations of branch bodies
251
+ mutation <<-RUBY
252
+ case :condition
253
+ when :foo
254
+ nil
255
+ else
256
+ :else
257
+ end
258
+ RUBY
259
+ mutation <<-RUBY
260
+ case :condition
261
+ when :foo
262
+ :foo__mutant__
263
+ else
264
+ :else
265
+ end
266
+ RUBY
267
+ mutation <<-RUBY
268
+ case :condition
269
+ when :foo
270
+ :foo
271
+ else
272
+ :else__mutant__
273
+ end
274
+ RUBY
275
+ mutation <<-RUBY
276
+ case :condition
277
+ when :foo
278
+ :foo
279
+ else
280
+ nil
281
+ end
282
+ RUBY
283
+
284
+ # Mutations of when conditions
285
+ mutation <<-RUBY
286
+ case :condition
287
+ when :foo__mutant__
288
+ :foo
289
+ else
290
+ :else
291
+ end
292
+ RUBY
293
+ mutation <<-RUBY
294
+ case :condition
295
+ when nil
296
+ :foo
297
+ else
298
+ :else
299
+ end
300
+ RUBY
301
+
302
+ mutation 'nil'
303
+ end