mutant 0.2.20 → 0.3.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +10 -11
  3. data/Changelog.md +93 -38
  4. data/Gemfile +3 -1
  5. data/Gemfile.devtools +16 -20
  6. data/Guardfile +1 -1
  7. data/README.md +36 -16
  8. data/Rakefile +21 -2
  9. data/TODO +11 -7
  10. data/bin/mutant +4 -0
  11. data/bin/zombie +4 -0
  12. data/config/devtools.yml +2 -0
  13. data/config/flay.yml +2 -2
  14. data/config/flog.yml +1 -1
  15. data/config/{site.reek → reek.yml} +94 -70
  16. data/lib/mutant/cli/classifier/method.rb +100 -0
  17. data/lib/mutant/cli/classifier/namespace.rb +47 -0
  18. data/lib/mutant/cli/classifier/scope.rb +35 -0
  19. data/lib/mutant/cli/classifier.rb +141 -0
  20. data/lib/mutant/cli.rb +115 -162
  21. data/lib/mutant/color.rb +2 -2
  22. data/lib/mutant/config.rb +27 -0
  23. data/lib/mutant/constants.rb +32 -17
  24. data/lib/mutant/context/scope.rb +33 -51
  25. data/lib/mutant/context.rb +8 -19
  26. data/lib/mutant/differ.rb +5 -5
  27. data/lib/mutant/helper.rb +2 -17
  28. data/lib/mutant/killer/forked.rb +44 -0
  29. data/lib/mutant/killer/forking.rb +3 -57
  30. data/lib/mutant/killer/rspec.rb +16 -20
  31. data/lib/mutant/killer/static.rb +6 -7
  32. data/lib/mutant/killer.rb +48 -74
  33. data/lib/mutant/loader.rb +6 -6
  34. data/lib/mutant/matcher/chain.rb +4 -25
  35. data/lib/mutant/matcher/method/instance.rb +14 -24
  36. data/lib/mutant/matcher/method/singleton.rb +35 -46
  37. data/lib/mutant/matcher/method.rb +95 -83
  38. data/lib/mutant/matcher/{scope_methods.rb → methods.rb} +53 -76
  39. data/lib/mutant/matcher/namespace.rb +71 -0
  40. data/lib/mutant/matcher/scope.rb +34 -0
  41. data/lib/mutant/matcher.rb +24 -34
  42. data/lib/mutant/mutation/evil.rb +35 -0
  43. data/lib/mutant/mutation/filter/code.rb +7 -28
  44. data/lib/mutant/mutation/filter/regexp.rb +6 -18
  45. data/lib/mutant/mutation/filter/whitelist.rb +5 -4
  46. data/lib/mutant/mutation/filter.rb +10 -9
  47. data/lib/mutant/mutation/neutral.rb +35 -0
  48. data/lib/mutant/mutation.rb +21 -61
  49. data/lib/mutant/mutator/node/argument.rb +88 -0
  50. data/lib/mutant/mutator/node/arguments.rb +52 -0
  51. data/lib/mutant/mutator/node/assignment.rb +34 -38
  52. data/lib/mutant/mutator/node/begin.rb +33 -0
  53. data/lib/mutant/mutator/node/block.rb +14 -14
  54. data/lib/mutant/mutator/node/case.rb +59 -0
  55. data/lib/mutant/mutator/node/define.rb +26 -22
  56. data/lib/mutant/mutator/node/if.rb +31 -71
  57. data/lib/mutant/mutator/node/literal/array.rb +25 -9
  58. data/lib/mutant/mutator/node/literal/boolean.rb +13 -30
  59. data/lib/mutant/mutator/node/literal/dynamic.rb +6 -5
  60. data/lib/mutant/mutator/node/literal/fixnum.rb +18 -7
  61. data/lib/mutant/mutator/node/literal/float.rb +15 -8
  62. data/lib/mutant/mutator/node/literal/hash.rb +33 -52
  63. data/lib/mutant/mutator/node/literal/nil.rb +8 -7
  64. data/lib/mutant/mutator/node/literal/range.rb +25 -50
  65. data/lib/mutant/mutator/node/literal/regex.rb +15 -23
  66. data/lib/mutant/mutator/node/literal/string.rb +7 -6
  67. data/lib/mutant/mutator/node/literal/symbol.rb +7 -6
  68. data/lib/mutant/mutator/node/literal.rb +4 -46
  69. data/lib/mutant/mutator/node/mlhs.rb +27 -0
  70. data/lib/mutant/mutator/node/noop.rb +18 -43
  71. data/lib/mutant/mutator/node/return.rb +8 -8
  72. data/lib/mutant/mutator/node/send/binary.rb +31 -0
  73. data/lib/mutant/mutator/node/send.rb +106 -72
  74. data/lib/mutant/mutator/node/super.rb +15 -20
  75. data/lib/mutant/mutator/node/when.rb +32 -7
  76. data/lib/mutant/mutator/node/while.rb +9 -7
  77. data/lib/mutant/mutator/node.rb +116 -66
  78. data/lib/mutant/mutator/registry.rb +14 -11
  79. data/lib/mutant/mutator/util/array.rb +9 -9
  80. data/lib/mutant/mutator/util/symbol.rb +6 -20
  81. data/lib/mutant/mutator/util.rb +6 -3
  82. data/lib/mutant/mutator.rb +12 -28
  83. data/lib/mutant/node_helpers.rb +28 -0
  84. data/lib/mutant/random.rb +3 -2
  85. data/lib/mutant/reporter/cli/printer/config.rb +174 -0
  86. data/lib/mutant/reporter/cli/printer/killer.rb +42 -0
  87. data/lib/mutant/reporter/cli/printer/mutation.rb +55 -0
  88. data/lib/mutant/reporter/cli/printer/subject.rb +147 -0
  89. data/lib/mutant/reporter/cli/printer.rb +165 -0
  90. data/lib/mutant/reporter/cli.rb +9 -277
  91. data/lib/mutant/reporter/null.rb +6 -30
  92. data/lib/mutant/reporter.rb +6 -73
  93. data/lib/mutant/runner/config.rb +82 -0
  94. data/lib/mutant/runner/mutation.rb +58 -0
  95. data/lib/mutant/runner/subject.rb +81 -0
  96. data/lib/mutant/runner.rb +42 -92
  97. data/lib/mutant/singleton_methods.rb +2 -2
  98. data/lib/mutant/strategy/method_expansion.rb +51 -0
  99. data/lib/mutant/strategy/rspec/dm2/lookup/method.rb +142 -0
  100. data/lib/mutant/strategy/rspec/dm2/lookup.rb +61 -0
  101. data/lib/mutant/strategy/rspec/dm2.rb +22 -0
  102. data/lib/mutant/strategy/rspec.rb +20 -22
  103. data/lib/mutant/strategy/static.rb +18 -0
  104. data/lib/mutant/strategy.rb +15 -50
  105. data/lib/mutant/subject/method.rb +100 -0
  106. data/lib/mutant/subject.rb +18 -49
  107. data/lib/mutant/support/method_object.rb +4 -2
  108. data/lib/mutant.rb +40 -35
  109. data/mutant.gemspec +9 -8
  110. data/spec/integration/mutant/rspec_killer_spec.rb +3 -3
  111. data/spec/integration/mutant/test_mutator_handles_types_spec.rb +9 -0
  112. data/spec/integration/mutant/zombie_spec.rb +1 -1
  113. data/spec/shared/method_matcher_behavior.rb +35 -0
  114. data/spec/shared/mutator_behavior.rb +63 -32
  115. data/spec/spec_helper.rb +13 -3
  116. data/spec/support/ice_nine_config.rb +8 -0
  117. data/spec/support/rspec.rb +1 -1
  118. data/spec/support/zombie.rb +1 -1
  119. data/spec/unit/mutant/cli/class_methods/new_spec.rb +42 -28
  120. data/spec/unit/mutant/cli/class_methods/run_spec.rb +15 -13
  121. data/spec/unit/mutant/cli/classifier/class_methods/build_spec.rb +44 -0
  122. data/spec/unit/mutant/context/scope/root_spec.rb +4 -4
  123. data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +6 -5
  124. data/spec/unit/mutant/killer/success_predicate_spec.rb +28 -0
  125. data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +1 -1
  126. data/spec/unit/mutant/matcher/chain/each_spec.rb +1 -1
  127. data/spec/unit/mutant/matcher/chain/matchers_spec.rb +1 -1
  128. data/spec/unit/mutant/matcher/method/instance/each_spec.rb +112 -0
  129. data/spec/unit/mutant/matcher/method/singleton/each_spec.rb +93 -0
  130. data/spec/unit/mutant/matcher/methods/instance/each_spec.rb +59 -0
  131. data/spec/unit/mutant/matcher/methods/singleton/each_spec.rb +53 -0
  132. data/spec/unit/mutant/matcher/namespace/each_spec.rb +37 -0
  133. data/spec/unit/mutant/mutator/node/begin/mutation_spec.rb +33 -0
  134. data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +42 -14
  135. data/spec/unit/mutant/mutator/node/case/mutation_spec.rb +319 -0
  136. data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +31 -27
  137. data/spec/unit/mutant/mutator/node/if/mutation_spec.rb +75 -0
  138. data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +1 -1
  139. data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +2 -2
  140. data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +1 -3
  141. data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +1 -9
  142. data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +6 -2
  143. data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +111 -108
  144. data/spec/unit/mutant/mutator/node/super/mutation_spec.rb +0 -33
  145. data/spec/unit/mutant/mutator/node/while/mutation_spec.rb +2 -2
  146. data/spec/unit/mutant/runner/config/subjects_spec.rb +38 -0
  147. data/spec/unit/mutant/runner/config/success_predicate_spec.rb +53 -0
  148. data/spec/unit/mutant/runner/failed_predicte_spec.rb +33 -0
  149. data/spec/unit/mutant/runner/mutation/killer_spec.rb +39 -0
  150. data/spec/unit/mutant/runner/subject/success_predicate_spec.rb +49 -0
  151. data/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb +49 -0
  152. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb +52 -0
  153. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb +42 -0
  154. data/spec/unit/mutant/subject/context_spec.rb +6 -3
  155. data/spec/unit/mutant/subject/each_spec.rb +11 -8
  156. data/spec/unit/mutant/subject/node_spec.rb +6 -2
  157. data/test_app/spec/shared/method_filter_parse_behavior.rb +0 -2
  158. data/test_app/spec/shared/method_match_behavior.rb +1 -1
  159. data/test_app/spec/spec_helper.rb +4 -2
  160. metadata +101 -109
  161. data/config/roodi.yml +0 -26
  162. data/lib/mutant/matcher/method/classifier.rb +0 -141
  163. data/lib/mutant/matcher/object_space.rb +0 -114
  164. data/lib/mutant/mutator/node/actual_arguments.rb +0 -25
  165. data/lib/mutant/mutator/node/default_arguments.rb +0 -25
  166. data/lib/mutant/mutator/node/formal_arguments_19/default_mutations.rb +0 -33
  167. data/lib/mutant/mutator/node/formal_arguments_19/pattern_argument_expansion.rb +0 -35
  168. data/lib/mutant/mutator/node/formal_arguments_19/require_defaults.rb +0 -37
  169. data/lib/mutant/mutator/node/formal_arguments_19.rb +0 -41
  170. data/lib/mutant/mutator/node/iter_19.rb +0 -27
  171. data/lib/mutant/mutator/node/literal/empty_array.rb +0 -26
  172. data/lib/mutant/mutator/node/pattern_arguments.rb +0 -41
  173. data/lib/mutant/mutator/node/pattern_variable.rb +0 -23
  174. data/lib/mutant/mutator/node/receiver_case.rb +0 -122
  175. data/lib/mutant/mutator/node/send/binary_operator_method.rb +0 -61
  176. data/lib/mutant/mutator/node/send/with_arguments.rb +0 -81
  177. data/lib/mutant/reporter/stats.rb +0 -120
  178. data/lib/mutant/strategy/rspec/example_lookup.rb +0 -163
  179. data/spec/integration/mutant/method_matching_spec.rb +0 -269
  180. data/spec/shared/method_match_behavior.rb +0 -39
  181. data/spec/unit/mutant/killer/fail_ques_spec.rb +0 -39
  182. data/spec/unit/mutant/matcher/class_methods/from_string_spec.rb +0 -49
  183. data/spec/unit/mutant/matcher/class_methods/parse_spec.rb +0 -12
  184. data/spec/unit/mutant/matcher/method/class_methods/parse_spec.rb +0 -21
  185. data/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb +0 -52
  186. data/spec/unit/mutant/matcher/object_space/class_methods/parse_spec.rb +0 -24
  187. data/spec/unit/mutant/matcher/object_space/each_spec.rb +0 -31
  188. data/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb +0 -60
  189. data/spec/unit/mutant/mutator/node/receiver_case/mutation_spec.rb +0 -27
  190. data/spec/unit/mutant/strategy/rspec/example_lookup/spec_file_spec.rb +0 -236
  191. data/spec/unit/mutant/subject/class_methods/new_spec.rb +0 -13
  192. data/tasks/metrics/ci.rake +0 -7
  193. data/tasks/metrics/flay.rake +0 -41
  194. data/tasks/metrics/flog.rake +0 -43
  195. data/tasks/metrics/heckle.rake +0 -216
  196. data/tasks/metrics/metric_fu.rake +0 -31
  197. data/tasks/metrics/reek.rake +0 -15
  198. data/tasks/metrics/roodi.rake +0 -15
  199. data/tasks/metrics/yardstick.rake +0 -23
  200. data/tasks/spec.rake +0 -45
  201. data/tasks/yard.rake +0 -9
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8076c9cdfc1fcf12d08d67b2b57bafdb5c9baff4
4
+ data.tar.gz: ab09a106e752bcc776d41ef04b5a77563eee0cf5
5
+ SHA512:
6
+ metadata.gz: a4dc97bbebfc57f572c0c040515403e1d3dd8d87d72c96b8931de25716e9bf9612c56822f65d823227a4f2d461247ab43b5278f5f206726e9146f508d36c05db
7
+ data.tar.gz: 67f727d12f7e6ba0c522e0d8de73cc8784648a3fa08dabf63eefb9580b560786b7bcafec6fe9733a708f88f6365bc189fac178f20789b1ec6b0723aa4443035d
data/.travis.yml CHANGED
@@ -1,20 +1,19 @@
1
1
  language: ruby
2
- script: 'bundle exec rake spec'
2
+ script: 'bundle exec rake ci'
3
3
  rvm:
4
- - 1.8.7
5
- - 1.9.2
6
4
  - 1.9.3
7
5
  - 2.0.0
8
6
  - ruby-head
9
7
  - rbx-19mode
8
+ - ruby-head
9
+ - jruby-19mode
10
10
  matrix:
11
11
  allow_failures:
12
- # No mutators for 1.8 specifc AST nodes
13
- - rvm: rbx-18mode
14
- - rvm: 1.8.7
15
- # We'll see what happens
16
- - rvm: ruby-head
17
- - rvm: 2.0.0
12
+ - rvm: jruby-19mode # No fork(2) support, workaround planned
13
+ - rvm: ruby-head # Broken at this time
18
14
  notifications:
19
- email:
20
- - mbj@seonic.net
15
+ irc:
16
+ channels:
17
+ - irc.freenode.org#rom-rb
18
+ on_success: never
19
+ on_failure: change
data/Changelog.md CHANGED
@@ -1,128 +1,183 @@
1
+ # v0.3.0 2013-06-xx
2
+
3
+ Feature:
4
+
5
+ * Rewrite all mutators on top of whitequark/parser
6
+ * Also mutate conditions in case statements
7
+
8
+ Bugfixes:
9
+
10
+ * Fix all bugs caused by mutant-melbourne
11
+
1
12
  # v0.2.20 2013-03-1
2
13
 
3
- * [change] Update dependencies
14
+ * Update dependencies
4
15
 
5
16
  [Compare v0.2.17..v0.2.20](https://github.com/mbj/mutant/compare/v0.2.17...v0.2.20)
6
17
 
7
18
  # v0.2.17 2013-01-20
8
19
 
9
- * [change] Update dependencies
20
+ * Kill mutations in #initialize from class methods.
21
+
22
+ # v0.2.17 2013-01-20
23
+
24
+ Other:
25
+
26
+ * Update dependencies
10
27
 
11
28
  [Compare v0.2.16..v0.2.17](https://github.com/mbj/mutant/compare/v0.2.16...v0.2.17)
12
29
 
13
30
  # v0.2.16 2013-01-20
14
31
 
15
- * [fixed] Handle Rubinius::AST::NthRef as noop
32
+ Bugfix:
33
+
34
+ * Handle Rubinius::AST::NthRef as noop
16
35
 
17
36
  [Compare v0.2.15..v0.2.16](https://github.com/mbj/mutant/compare/v0.2.15...v0.2.16)
18
37
 
19
38
  # v0.2.15 2013-01-10
20
39
 
21
- * [change] Do not mutate super to super() anymore. This needs a context check in future.
40
+ Bugfix:
41
+
42
+ * Do not mutate super to super() anymore. This needs a context check in future.
22
43
 
23
44
  [Compare v0.2.14..v0.2.15](https://github.com/mbj/mutant/compare/v0.2.14...v0.2.15)
24
45
 
25
46
  # v0.2.14 2013-01-09
26
47
 
27
- * [change] Do not emit mutation to { nil => nil } for hash literals
48
+ Bugfix:
49
+
50
+ * Do not emit mutation to { nil => nil } for hash literals
28
51
 
29
52
  [Compare v0.2.13..v0.2.14](https://github.com/mbj/mutant/compare/v0.2.13...v0.2.14)
30
53
 
31
54
  # v0.2.13 2013-01-09
32
55
 
33
- * [fixed] Capture failures that occur in the window between mutation insertion and spec run as kills
56
+ Bugfix:
57
+
58
+ * Capture failures that occur in the window between mutation insertion and spec run as kills
34
59
 
35
60
  [Compare v0.2.12..v0.2.13](https://github.com/mbj/mutant/compare/v0.2.12...v0.2.13)
36
61
 
37
62
  # v0.2.12 2013-01-03
38
63
 
39
- * [fixed] Do not crash when trying to load methods from precompiled ruby under rbx
64
+ Bugfix:
65
+
66
+ * Do not crash when trying to load methods from precompiled ruby under rbx
40
67
 
41
68
  [Compare v0.2.11..v0.2.12](https://github.com/mbj/mutant/compare/v0.2.11...v0.2.12)
42
69
 
43
70
  # v0.2.11 2013-01-03
44
71
 
45
- * [change] Handle binary operator methods in dedicated mutator
46
- * [fixed] Do not crash when mutating binary operator method
72
+ Feature:
73
+
74
+ * Handle binary operator methods in dedicated mutator
75
+
76
+ Bugfix:
77
+
78
+ * Do not crash when mutating binary operator method
47
79
 
48
80
  [Compare v0.2.10..v0.2.11](https://github.com/mbj/mutant/compare/v0.2.10...v0.2.11)
49
81
 
50
82
  # v0.2.10 2013-01-03
51
83
 
52
- * [fixed] Do not mutate receivers away when message name is a keyword
84
+ Bugfix:
85
+
86
+ * Do not mutate receivers away when message name is a keyword
53
87
 
54
88
  [Compare v0.2.9..v0.2.10](https://github.com/mbj/mutant/compare/v0.2.9...v0.2.10)
55
89
 
56
90
  # v0.2.9 2013-01-02
57
91
 
58
- * [feature] Mutate instance and global variable assignments
59
- * [feature] Mutate super calls
92
+ Feature:
93
+
94
+ * Mutate instance and global variable assignments
95
+ * Mutate super calls
60
96
 
61
97
  [Compare v0.2.8..v0.2.9](https://github.com/mbj/mutant/compare/v0.2.8...v0.2.9)
62
98
 
63
99
  # v0.2.8 2012-12-29
64
100
 
65
- * [feature] Do not mutate argument or local variable names beginning with an underscore
66
- * [feature] Mutate unary calls ```coerce(object)``` => ```object```
67
- * [feature] Mutate method call receivers ```foo.bar``` => ```foo```
101
+ Feature:
102
+
103
+ * Do not mutate argument or local variable names beginning with an underscore
104
+ * Mutate unary calls ```coerce(object)``` => ```object```
105
+ * Mutate method call receivers ```foo.bar``` => ```foo```
68
106
 
69
107
  [Compare v0.2.7..v0.2.8](https://github.com/mbj/mutant/compare/v0.2.7...v0.2.8)
70
108
 
71
109
  # v0.2.7 2012-12-21
72
110
 
73
- * [fixed] Use latest adamantium and ice_nine
111
+ Feature:
112
+
113
+ * Use latest adamantium and ice_nine
74
114
 
75
115
  [Compare v0.2.6..v0.2.7](https://github.com/mbj/mutant/compare/v0.2.6...v0.2.7)
76
116
 
77
117
  # v0.2.6 2012-12-14
78
118
 
79
- * [fixed] Correctly set file and line of injected mutants
119
+ Bugfix:
120
+
121
+ * Correctly set file and line of injected mutants
80
122
 
81
123
  [Compare v0.2.5..v0.2.6](https://github.com/mbj/mutant/compare/v0.2.5...v0.2.6)
82
124
 
83
125
  # v0.2.5 2012-12-12
84
126
 
85
- * [feature] Add --debug flag for showing killer output and mutation
86
- * [feature] Run noop mutation per subject to guard against initial failing specs
87
- * [feature] Mutate default into required arguments
88
- * [feature] Mutate default literals
89
- * [feature] Mutate unwinding of pattern args ```|(a, b), c|``` => ```|a, b, c|```
90
- * [feature] Mutate define and block arguments
91
- * [feature] Mutate block arguments, inklusive pattern args
92
- * [feature] Recurse into block bodies
93
- * [change] Unvendor inflector use mbj-inflector from rubygems
94
- * [fixed] Insert mutations at correct constant scope
95
- * [fixed] Crash on mutating yield, added a noop for now
96
- * [fixed] Crash on singleton methods defined on other than constants or self
127
+ Feature:
128
+
129
+ * Add --debug flag for showing killer output and mutation
130
+ * Run noop mutation per subject to guard against initial failing specs
131
+ * Mutate default into required arguments
132
+ * Mutate default literals
133
+ * Mutate unwinding of pattern args ```|(a, b), c|``` => ```|a, b, c|```
134
+ * Mutate define and block arguments
135
+ * Mutate block arguments, inklusive pattern args
136
+ * Recurse into block bodies
137
+ * Unvendor inflector use mbj-inflector from rubygems
138
+
139
+ Bugfix:
140
+
141
+ * Insert mutations at correct constant scope
142
+ * Crash on mutating yield, added a noop for now
143
+ * Crash on singleton methods defined on other than constants or self
97
144
 
98
145
  [Compare v0.2.4..v0.2.5](https://github.com/mbj/mutant/compare/v0.2.4...v0.2.5)
99
146
 
100
147
  # v0.2.4 2012-12-12
101
148
 
102
- * [fixed] Correctly vendor inflector
149
+ Bugfix:
150
+
151
+ * Correctly vendor inflector
103
152
 
104
153
  [Compare v0.2.3..v0.2.4](https://github.com/mbj/mutant/compare/v0.2.3...v0.2.4)
105
154
 
106
155
  # v0.2.3 2012-12-08
107
156
 
108
- * [fixed] Prepend extra elements to hash and array instead of append. This fixes unkillable mutators in parallel assignments!
157
+ Bugfix:
158
+
159
+ * Prepend extra elements to hash and array instead of append. This fixes unkillable mutators in parallel assignments!
109
160
 
110
161
  [Compare v0.2.2..v0.2.3](https://github.com/mbj/mutant/compare/v0.2.2...v0.2.3)
111
162
 
112
163
  # v0.2.2 2012-12-07
113
164
 
114
- * [feature] Add a shitload of operator expansions for dm2 strategy
165
+ Feature:
166
+
167
+ * Add a shitload of operator expansions for dm2 strategy
115
168
 
116
169
  [Compare v0.2.1..v0.2.2](https://github.com/mbj/mutant/compare/v0.2.1...v0.2.2)
117
170
 
118
171
  # v0.2.1 2012-12-07
119
172
 
120
- * [fixed] Crash on unavailable source location
121
- * [fixed] Incorrect handling of if and unless statements
122
- * [fixed] Expand Foo#initialize to spec/unit/foo in rspec dm2 strategy
123
- * [fixed] Correctly expand [] to element_reader_spec.rb in rspec dm2 strategy
124
- * [fixed] Correctly expand []= to element_writer_spec.rb in rspec dm2 strategy
125
- * [fixed] Correctly expand foo= to foo_writer_spec.rb in rspec dm2 strategy
173
+ Bugfix:
174
+
175
+ * Crash on unavailable source location
176
+ * Incorrect handling of if and unless statements
177
+ * Expand Foo#initialize to spec/unit/foo in rspec dm2 strategy
178
+ * Correctly expand [] to element_reader_spec.rb in rspec dm2 strategy
179
+ * Correctly expand []= to element_writer_spec.rb in rspec dm2 strategy
180
+ * Correctly expand foo= to foo_writer_spec.rb in rspec dm2 strategy
126
181
 
127
182
  [Compare v0.2.0..v0.2.1](https://github.com/mbj/mutant/compare/v0.2.0...v0.2.1)
128
183
 
data/Gemfile CHANGED
@@ -2,5 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'devtools', :git => 'https://github.com/datamapper/devtools.git'
5
+ gem 'mutant', :path => '.'
6
+
7
+ gem 'devtools', :git => 'https://github.com/rom-rb/devtools.git'
6
8
  eval(File.read(File.join(File.dirname(__FILE__),'Gemfile.devtools')))
data/Gemfile.devtools CHANGED
@@ -1,27 +1,26 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  group :development do
4
- gem 'rake', '~> 10.0.3'
4
+ gem 'rake', '~> 10.1.0'
5
5
  gem 'rspec', '~> 2.13.0'
6
- gem 'yard', '~> 0.8.5'
6
+ gem 'yard', '~> 0.8.6.1'
7
7
  end
8
8
 
9
9
  group :yard do
10
- gem 'kramdown', '~> 0.14.2'
10
+ gem 'kramdown', '~> 1.0.1'
11
11
  end
12
12
 
13
13
  group :guard do
14
- gem 'guard', '~> 1.6.2'
14
+ gem 'guard', '~> 1.8.1'
15
15
  gem 'guard-bundler', '~> 1.0.0'
16
- gem 'guard-rspec', '~> 2.4.1'
16
+ gem 'guard-rspec', '~> 3.0.2'
17
17
 
18
18
  # file system change event handling
19
+ gem 'listen', '~> 1.2.2'
19
20
  gem 'rb-fchange', '~> 0.0.6', :require => false
20
21
  gem 'rb-fsevent', '~> 0.9.3', :require => false
21
22
  gem 'rb-inotify', '~> 0.9.0', :require => false
22
23
 
23
- gem 'listen', '~> 0.7.3'
24
-
25
24
  # notification handling
26
25
  gem 'libnotify', '~> 0.8.0', :require => false
27
26
  gem 'rb-notifu', '~> 0.0.4', :require => false
@@ -29,21 +28,18 @@ group :guard do
29
28
  end
30
29
 
31
30
  group :metrics do
32
- gem 'flay', '~> 2.1.0'
33
- gem 'flog', '~> 3.2.2'
34
- gem 'reek', '~> 1.3.1'
35
- gem 'metric_fu-roodi', '~> 2.2.1'
36
- gem 'yardstick', '~> 0.9.3', :git => 'https://github.com/dkubb/yardstick.git'
37
-
38
- platforms :ruby_18, :ruby_19 do
39
- # this indirectly depends on ffi which does not build on ruby-head
31
+ gem 'backports', '~> 3.3', '>= 3.3.2'
32
+ gem 'coveralls', '~> 0.6.7'
33
+ gem 'flay', '~> 2.3.0'
34
+ gem 'flog', '~> 4.1.0'
35
+ gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
36
+ gem 'simplecov', '~> 0.7.1'
37
+ gem 'yardstick', '~> 0.9.6'
38
+
39
+ platforms :ruby_19 do
40
40
  gem 'yard-spellcheck', '~> 0.1.5'
41
41
  end
42
42
 
43
- platforms :mri_19 do
44
- gem 'simplecov', '~> 0.7.1'
45
- end
46
-
47
43
  platforms :rbx do
48
44
  gem 'pelusa', '~> 0.2.2'
49
45
  end
@@ -55,6 +51,6 @@ end
55
51
 
56
52
  platform :jruby do
57
53
  group :jruby do
58
- gem 'jruby-openssl', '~> 0.8.2'
54
+ gem 'jruby-openssl', '~> 0.8.5'
59
55
  end
60
56
  end
data/Guardfile CHANGED
@@ -4,7 +4,7 @@ guard :bundler do
4
4
  watch('Gemfile')
5
5
  end
6
6
 
7
- guard :rspec, :all_on_start => false, :all_after_pass => false do
7
+ guard :rspec, :cli => '--fail-fast', :all_on_start => false, :all_after_pass => false do
8
8
  # run all specs if the spec_helper or supporting files files are modified
9
9
  watch('spec/spec_helper.rb') { 'spec/unit' }
10
10
  watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec/unit' }
data/README.md CHANGED
@@ -3,27 +3,36 @@ mutant
3
3
 
4
4
  [![Build Status](https://secure.travis-ci.org/mbj/mutant.png?branch=master)](http://travis-ci.org/mbj/mutant)
5
5
  [![Dependency Status](https://gemnasium.com/mbj/mutant.png)](https://gemnasium.com/mbj/mutant)
6
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/mbj/mutant)
6
+ [![Code Climate](https://codeclimate.com/github/mbj/mutant.png)](https://codeclimate.com/github/mbj/mutant)
7
7
 
8
- Mutant is a mutation testing tool for ruby that aims to be better than existing mutation testers.
8
+ Mutant is a mutation testing tool for ruby. It aims to be better than existing mutation testers.
9
9
 
10
- The idea is that if code can be changed and your tests do not notice, either that code isn't being covered
10
+ The idea is that if code can be changed and your tests do not notice, either that code isn't being covered
11
11
  or it does not have a speced side effect.
12
12
 
13
- Mutant does currently only support 1.9 mode under Rubinius or MRI. Support for JRuby is planned.
13
+ Mutant supports MRI and RBX gte 19-mode (1.9.3!), while support for jruby is planned. It should also work under any ruby
14
+ engine that supports POSIX-fork(2) semantics.
14
15
 
15
- Also it is easy to write a mutation killer for other test/spec frameworks than rspec2.
16
+ Only rspec2 is supported currently. This is subject to change.
17
+
18
+ It is easy to write a mutation killer for other test/spec frameworks than rspec2.
16
19
  Just create your own Mutant::Killer subclass, and make sure I get a PR!
17
20
 
18
21
  See this [ASCII-Cast](http://ascii.io/a/1707) for mutant in action! (v0.2.1)
19
22
 
20
- Using Mutant
21
- ------------
23
+ Projects using Mutant
24
+ ---------------------
22
25
 
23
- The following projects adopted mutant.
26
+ The following projects adopted mutant, and aim 100% mutation coverage:
24
27
 
25
- * [dm-mapper](https://github.com/datamapper/dm-mapper)
28
+ * [axiom](https://github.com/dkubb/axiom)
29
+ * [axiom-types](https://github.com/dkubb/axiom-types)
30
+ * [rom-mapper](https://github.com/rom/rom-mapper)
31
+ * [rom-session](https://github.com/rom/rom-session)
32
+ * [event_bus](https://github.com/kevinrutherford/event_bus)
26
33
  * [virtus](https://github.com/solnic/virtus)
34
+ * [quacky](https://github.com/benmoss/quacky)
35
+ * [substation](https://github.com/snusnu/substation)
27
36
  * various small/minor stuff under https://github.com/mbj
28
37
 
29
38
  Feel free to ping me to add your project to the list!
@@ -31,7 +40,7 @@ Feel free to ping me to add your project to the list!
31
40
  Installation
32
41
  ------------
33
42
 
34
- Install the gem ``mutant`` via your preferred method.
43
+ Install the gem `mutant` via your preferred method.
35
44
 
36
45
  Examples
37
46
  --------
@@ -42,7 +51,7 @@ CLI will be simplified in the next releases, but currently stick with this:
42
51
  cd virtus
43
52
  # Run mutant on virtus namespace (that uses the dm-2 style spec layout)
44
53
  mutant -I lib -r virtus --rspec-dm2 ::Virtus
45
- # Run mutant on specific virtus class
54
+ # Run mutant on specific virtus class
46
55
  mutant -I lib -r virtus --rspec-dm2 ::Virtus::Attribute
47
56
  # Run mutant on specific virtus class method
48
57
  mutant -I lib -r virtus --rspec-dm2 ::Virtus::Attribute.build
@@ -53,8 +62,8 @@ mutant -I lib -r virtus --rspec-dm2 ::Virtus::Attribute#name
53
62
  Strategies
54
63
  ----------
55
64
 
56
- Mutation testing is slow. To make it fast the selection of the correct set of tests to run is the key.
57
- Mutant currently supports the following buildin strategies for selecting tests/specs.
65
+ Mutation testing is slow. The key to making it fast is selecting the correct set of tests to run.
66
+ Mutant currently supports the following built-in strategies for selecting tests/specs.
58
67
 
59
68
  ### --rspec-dm2
60
69
 
@@ -70,12 +79,12 @@ Private singleton methods: spec/unit/#{namespace}/#{class_name}/class_methods/*_
70
79
 
71
80
  #### Expansions:
72
81
 
73
- Symbolic operator like method are expanded. So for example ```Foo#<<``` is expanded to:
82
+ Symbolic operator-like methods are expanded, e.g. ```Foo#<<``` is expanded to:
74
83
  ```
75
84
  spec/unit/foo/left_shift_operator_spec.rb
76
85
  ````
77
86
 
78
- The full list of expansion can be found here:
87
+ The full list of expansions can be found here:
79
88
 
80
89
  https://github.com/mbj/mutant/blob/master/lib/mutant/constants.rb
81
90
 
@@ -91,7 +100,7 @@ This strategy executes all specs under ``./spec/integration`` for each mutation.
91
100
 
92
101
  This strategy executes all specs under ``./spec`` for each mutation.
93
102
 
94
- It is also plannned to allow explicit selections on specs to run and to support other test frameworks.
103
+ In the future, we plan on allowing explicit selections on the specs to be run, as well as support for other test frameworks.
95
104
  Custom project specific strategies are also on the roadmap.
96
105
 
97
106
  Alternatives
@@ -99,6 +108,17 @@ Alternatives
99
108
 
100
109
  * [heckle](https://github.com/seattlerb/heckle)
101
110
 
111
+ Support
112
+ -------
113
+
114
+ I'm very happy to receive/answer feedback/questions and critism.
115
+
116
+ Your options:
117
+
118
+ * GitHub Issues https://github.com/mbj/mutant/issues
119
+ * Ping me on https://twitter.com/_m_b_j_
120
+ * #rom-rb channel on freenode, I hang around on CET daytimes. (nick mbj)
121
+
102
122
  Credits
103
123
  -------
104
124
 
data/Rakefile CHANGED
@@ -1,4 +1,23 @@
1
- require 'rake'
2
1
  require 'devtools'
2
+ Devtools.init_rake_tasks
3
3
 
4
- Devtools.init
4
+ class Rake::Task
5
+ def overwrite(&block)
6
+ @actions.clear
7
+ enhance(&block)
8
+ end
9
+ end
10
+
11
+ Rake.application.load_imports
12
+
13
+ Rake::Task['metrics:mutant'].overwrite do
14
+ $stderr.puts "Mutant self mutation (Zombie) is deactivated"
15
+ # project = Devtools.project
16
+ # require File.expand_path('../spec/support/zombie.rb', __FILE__)
17
+ # Zombie.setup
18
+ # status = Zombie::CLI.run(%W(::Mutant --rspec-dm2))
19
+ # if status.nonzero?
20
+ # $stderr.puts 'Zombie task is not successful'
21
+ # $stderr.puts 'Not fatal at this point of development, will be fixed before release of 0.3.0'
22
+ # end
23
+ end
data/TODO CHANGED
@@ -2,10 +2,11 @@ Code:
2
2
  * Test mutant with dynamically created zombie.
3
3
  * Fix ugly code within default parameter mutations
4
4
  * Break up lib/mutant/mutator/node/send.rb in class specific files
5
- * Log all warnings throug reporter, so remove random $stderr.puts calls
5
+ * Log all warnings through reporter, so remove random $stderr.puts calls
6
+ * Use rational to represent percent values
6
7
 
7
8
  AST:
8
- * Fix the rubinius AST to allow setting @vcall_style variable in Rubinius::AST::Send nodes.
9
+ * Use whitequarcks parser and the to be writte unparser. This fixes all RBX AST issues.
9
10
 
10
11
  Mutations:
11
12
  * Add binary operator specific mutations (YAY, finally reached this point)
@@ -15,11 +16,12 @@ Mutations:
15
16
  * Mutate options on Regexp literals
16
17
  * Add mutations for dynamic regexp symbol and string literals
17
18
  * Mutate "def foo; bar; end" to "def foo; self; end"?
18
- * Emit negative and positive mutations
19
+ * Emit negative and positive mutations
19
20
  * Mutate Block catch "def foo(&block)" and block pass "foo(&block)"
20
21
  * Mutate super arguments just like send arguments
22
+ * Binary operator mutations
21
23
  * Add timeout to terminate infinite loops
22
-
24
+
23
25
  Example of a negative mutation:
24
26
  Mutations on local variables and arguments prefixed with an underscore would be emitted as
25
27
  negative mutations that must be alive.
@@ -29,18 +31,20 @@ Loader:
29
31
 
30
32
  Killers:
31
33
  * Move test framework specific stuff to strategy
32
- * Add a general master <=> killer IPC interface. So different strategies of isolation
34
+ * Add a general master <=> killer IPC interface. So different strategies of isolation
33
35
  (fork, vs jruby runtime creation) will work without big impact.
34
36
 
37
+ Kill:
38
+ * Introduce mutant Kill that acts as a DTO between killer and runner. (Simplifies reporting)
39
+
35
40
  Strategy:
36
41
  * Aggregate warnings on missing spec files
37
42
  * Provide "expicit files to kill with" strategy
38
- * Automatically load ./spec/spec_helper.rb for rspec strategies (No need to specify -I and -r anymore)
39
43
 
40
44
  Matcher:
41
45
  * Allow matches on attr_reader with literal name argument(s)?
42
46
  * Allow matches on define_method with literal name argument?
43
47
 
44
48
  jruby-support:
45
- * Hook melbourne via ffi
49
+ * Use whitequarck parser
46
50
  * Create a runtime per mutation to kill mutations in isolation
data/bin/mutant CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ trap('INT') do |status|
4
+ exit! 128+status
5
+ end
6
+
3
7
  require 'mutant'
4
8
 
5
9
  namespace =
data/bin/zombie CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ trap('INT') do |status|
4
+ exit! 128+status
5
+ end
6
+
3
7
  require 'mutant'
4
8
 
5
9
  namespace =
@@ -0,0 +1,2 @@
1
+ ---
2
+ unit_test_timeout: 1.0
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
- threshold: 25 # Todo bring down to ~20
3
- total_score: 914
2
+ threshold: 16
3
+ total_score: 604
data/config/flog.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 44.0
2
+ threshold: 19.8