mutant 0.8.24 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -3
  3. data/Changelog.md +14 -654
  4. data/Gemfile +13 -0
  5. data/Gemfile.lock +59 -64
  6. data/LICENSE +271 -20
  7. data/README.md +73 -140
  8. data/Rakefile +0 -21
  9. data/bin/mutant +7 -2
  10. data/config/reek.yml +2 -1
  11. data/config/rubocop.yml +5 -9
  12. data/docs/incremental.md +76 -0
  13. data/docs/known-problems.md +0 -14
  14. data/docs/mutant-minitest.md +1 -1
  15. data/docs/mutant-rspec.md +2 -24
  16. data/lib/mutant.rb +45 -53
  17. data/lib/mutant/ast/nodes.rb +0 -2
  18. data/lib/mutant/ast/types.rb +1 -117
  19. data/lib/mutant/base.rb +192 -0
  20. data/lib/mutant/bootstrap.rb +145 -0
  21. data/lib/mutant/cli.rb +68 -54
  22. data/lib/mutant/config.rb +119 -6
  23. data/lib/mutant/env.rb +94 -8
  24. data/lib/mutant/expression.rb +6 -1
  25. data/lib/mutant/expression/parser.rb +9 -31
  26. data/lib/mutant/integration.rb +64 -36
  27. data/lib/mutant/isolation.rb +16 -1
  28. data/lib/mutant/isolation/fork.rb +105 -40
  29. data/lib/mutant/license.rb +34 -0
  30. data/lib/mutant/license/subscription.rb +47 -0
  31. data/lib/mutant/license/subscription/commercial.rb +57 -0
  32. data/lib/mutant/license/subscription/opensource.rb +77 -0
  33. data/lib/mutant/loader.rb +27 -4
  34. data/lib/mutant/matcher.rb +48 -1
  35. data/lib/mutant/matcher/chain.rb +1 -1
  36. data/lib/mutant/matcher/config.rb +0 -2
  37. data/lib/mutant/matcher/filter.rb +1 -1
  38. data/lib/mutant/matcher/method.rb +11 -7
  39. data/lib/mutant/matcher/methods.rb +1 -1
  40. data/lib/mutant/matcher/namespace.rb +1 -1
  41. data/lib/mutant/matcher/null.rb +1 -1
  42. data/lib/mutant/matcher/scope.rb +1 -1
  43. data/lib/mutant/meta/example/dsl.rb +0 -8
  44. data/lib/mutant/mutation.rb +1 -2
  45. data/lib/mutant/mutator/node.rb +2 -9
  46. data/lib/mutant/mutator/node/arguments.rb +1 -1
  47. data/lib/mutant/mutator/node/class.rb +0 -8
  48. data/lib/mutant/mutator/node/define.rb +0 -12
  49. data/lib/mutant/mutator/node/generic.rb +30 -44
  50. data/lib/mutant/mutator/node/index.rb +4 -4
  51. data/lib/mutant/mutator/node/literal/regex.rb +0 -39
  52. data/lib/mutant/mutator/node/send.rb +13 -12
  53. data/lib/mutant/parallel.rb +61 -40
  54. data/lib/mutant/parallel/driver.rb +59 -0
  55. data/lib/mutant/parallel/source.rb +6 -2
  56. data/lib/mutant/parallel/worker.rb +63 -45
  57. data/lib/mutant/range.rb +15 -0
  58. data/lib/mutant/reporter/cli.rb +5 -11
  59. data/lib/mutant/reporter/cli/format.rb +3 -46
  60. data/lib/mutant/reporter/cli/printer/config.rb +5 -6
  61. data/lib/mutant/reporter/cli/printer/env.rb +40 -0
  62. data/lib/mutant/reporter/cli/printer/env_progress.rb +13 -17
  63. data/lib/mutant/reporter/cli/printer/isolation_result.rb +17 -3
  64. data/lib/mutant/reporter/cli/printer/mutation_result.rb +2 -3
  65. data/lib/mutant/reporter/cli/printer/status_progressive.rb +19 -10
  66. data/lib/mutant/repository.rb +0 -65
  67. data/lib/mutant/repository/diff.rb +104 -0
  68. data/lib/mutant/repository/diff/ranges.rb +52 -0
  69. data/lib/mutant/result.rb +16 -7
  70. data/lib/mutant/runner.rb +38 -47
  71. data/lib/mutant/runner/sink.rb +1 -1
  72. data/lib/mutant/selector/null.rb +19 -0
  73. data/lib/mutant/subject.rb +3 -1
  74. data/lib/mutant/subject/method/instance.rb +3 -1
  75. data/lib/mutant/transform.rb +511 -0
  76. data/lib/mutant/variable.rb +282 -0
  77. data/lib/mutant/version.rb +1 -1
  78. data/lib/mutant/warnings.rb +113 -0
  79. data/meta/case.rb +1 -0
  80. data/meta/class.rb +0 -9
  81. data/meta/def.rb +1 -26
  82. data/meta/regexp.rb +10 -20
  83. data/meta/send.rb +14 -46
  84. data/mutant-minitest.gemspec +1 -1
  85. data/mutant-rspec.gemspec +2 -2
  86. data/mutant.gemspec +15 -16
  87. data/mutant.yml +6 -0
  88. data/spec/integration/mutant/isolation/fork_spec.rb +22 -5
  89. data/spec/integration/mutant/minitest_spec.rb +3 -2
  90. data/spec/integration/mutant/rspec_spec.rb +4 -3
  91. data/spec/integrations.yml +16 -13
  92. data/spec/shared/base_behavior.rb +45 -0
  93. data/spec/shared/framework_integration_behavior.rb +43 -14
  94. data/spec/spec_helper.rb +21 -17
  95. data/spec/support/corpus.rb +56 -95
  96. data/spec/support/shared_context.rb +37 -14
  97. data/spec/support/xspec.rb +7 -3
  98. data/spec/unit/mutant/bootstrap_spec.rb +216 -0
  99. data/spec/unit/mutant/cli_spec.rb +173 -117
  100. data/spec/unit/mutant/config_spec.rb +126 -0
  101. data/spec/unit/mutant/either_spec.rb +247 -0
  102. data/spec/unit/mutant/env_spec.rb +162 -40
  103. data/spec/unit/mutant/expression/method_spec.rb +16 -0
  104. data/spec/unit/mutant/expression/parser_spec.rb +29 -33
  105. data/spec/unit/mutant/expression_spec.rb +5 -7
  106. data/spec/unit/mutant/integration_spec.rb +100 -9
  107. data/spec/unit/mutant/isolation/fork_spec.rb +125 -67
  108. data/spec/unit/mutant/isolation/result_spec.rb +33 -1
  109. data/spec/unit/mutant/license_spec.rb +257 -0
  110. data/spec/unit/mutant/loader_spec.rb +50 -11
  111. data/spec/unit/mutant/matcher/compiler_spec.rb +0 -78
  112. data/spec/unit/mutant/matcher/method/instance_spec.rb +55 -11
  113. data/spec/unit/mutant/matcher/method/singleton_spec.rb +12 -2
  114. data/spec/unit/mutant/matcher_spec.rb +102 -0
  115. data/spec/unit/mutant/maybe_spec.rb +60 -0
  116. data/spec/unit/mutant/meta/example/dsl_spec.rb +1 -17
  117. data/spec/unit/mutant/mutation_spec.rb +13 -6
  118. data/spec/unit/mutant/parallel/driver_spec.rb +112 -14
  119. data/spec/unit/mutant/parallel/source/array_spec.rb +25 -17
  120. data/spec/unit/mutant/parallel/worker_spec.rb +182 -44
  121. data/spec/unit/mutant/parallel_spec.rb +105 -8
  122. data/spec/unit/mutant/range_spec.rb +141 -0
  123. data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +7 -21
  124. data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +15 -6
  125. data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +10 -2
  126. data/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb +12 -4
  127. data/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +31 -2
  128. data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +4 -4
  129. data/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +5 -0
  130. data/spec/unit/mutant/reporter/cli_spec.rb +46 -123
  131. data/spec/unit/mutant/repository/diff/ranges_spec.rb +180 -0
  132. data/spec/unit/mutant/repository/diff_spec.rb +84 -71
  133. data/spec/unit/mutant/require_highjack_spec.rb +1 -1
  134. data/spec/unit/mutant/result/env_spec.rb +39 -9
  135. data/spec/unit/mutant/result/test_spec.rb +14 -0
  136. data/spec/unit/mutant/runner_spec.rb +88 -41
  137. data/spec/unit/mutant/selector/expression_spec.rb +11 -10
  138. data/spec/unit/mutant/selector/null_spec.rb +17 -0
  139. data/spec/unit/mutant/subject/method/instance_spec.rb +44 -5
  140. data/spec/unit/mutant/subject/method/singleton_spec.rb +9 -2
  141. data/spec/unit/mutant/subject_spec.rb +9 -1
  142. data/spec/unit/mutant/transform/array_spec.rb +92 -0
  143. data/spec/unit/mutant/transform/bool_spec.rb +63 -0
  144. data/spec/unit/mutant/transform/error_spec.rb +132 -0
  145. data/spec/unit/mutant/transform/exception_spec.rb +44 -0
  146. data/spec/unit/mutant/transform/hash_spec.rb +236 -0
  147. data/spec/unit/mutant/transform/index_spec.rb +92 -0
  148. data/spec/unit/mutant/transform/named_spec.rb +49 -0
  149. data/spec/unit/mutant/transform/primitive_spec.rb +56 -0
  150. data/spec/unit/mutant/transform/sequence_spec.rb +98 -0
  151. data/spec/unit/mutant/variable_spec.rb +618 -0
  152. data/spec/unit/mutant/warnings_spec.rb +89 -0
  153. data/spec/unit/mutant/world_spec.rb +63 -0
  154. data/test_app/Gemfile.minitest +0 -2
  155. metadata +79 -113
  156. data/.gitattributes +0 -1
  157. data/.ruby-gemset +0 -1
  158. data/config/triage.yml +0 -2
  159. data/lib/mutant/actor.rb +0 -57
  160. data/lib/mutant/actor/env.rb +0 -31
  161. data/lib/mutant/actor/mailbox.rb +0 -34
  162. data/lib/mutant/actor/receiver.rb +0 -42
  163. data/lib/mutant/actor/sender.rb +0 -26
  164. data/lib/mutant/ast/meta/restarg.rb +0 -19
  165. data/lib/mutant/ast/regexp.rb +0 -42
  166. data/lib/mutant/ast/regexp/transformer.rb +0 -187
  167. data/lib/mutant/ast/regexp/transformer/direct.rb +0 -123
  168. data/lib/mutant/ast/regexp/transformer/named_group.rb +0 -59
  169. data/lib/mutant/ast/regexp/transformer/options_group.rb +0 -83
  170. data/lib/mutant/ast/regexp/transformer/quantifier.rb +0 -114
  171. data/lib/mutant/ast/regexp/transformer/recursive.rb +0 -58
  172. data/lib/mutant/ast/regexp/transformer/root.rb +0 -31
  173. data/lib/mutant/ast/regexp/transformer/text.rb +0 -60
  174. data/lib/mutant/env/bootstrap.rb +0 -160
  175. data/lib/mutant/matcher/compiler.rb +0 -60
  176. data/lib/mutant/mutator/node/regexp.rb +0 -35
  177. data/lib/mutant/mutator/node/regexp/alternation_meta.rb +0 -23
  178. data/lib/mutant/mutator/node/regexp/capture_group.rb +0 -28
  179. data/lib/mutant/mutator/node/regexp/character_type.rb +0 -32
  180. data/lib/mutant/mutator/node/regexp/end_of_line_anchor.rb +0 -23
  181. data/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb +0 -23
  182. data/lib/mutant/mutator/node/regexp/greedy_zero_or_more.rb +0 -27
  183. data/lib/mutant/parallel/master.rb +0 -181
  184. data/lib/mutant/reporter/cli/printer/status.rb +0 -53
  185. data/lib/mutant/reporter/cli/tput.rb +0 -46
  186. data/lib/mutant/warning_filter.rb +0 -61
  187. data/meta/regexp/character_types.rb +0 -23
  188. data/meta/regexp/regexp_alternation_meta.rb +0 -13
  189. data/meta/regexp/regexp_bol_anchor.rb +0 -10
  190. data/meta/regexp/regexp_bos_anchor.rb +0 -18
  191. data/meta/regexp/regexp_capture_group.rb +0 -19
  192. data/meta/regexp/regexp_eol_anchor.rb +0 -10
  193. data/meta/regexp/regexp_eos_anchor.rb +0 -8
  194. data/meta/regexp/regexp_eos_ob_eol_anchor.rb +0 -10
  195. data/meta/regexp/regexp_greedy_zero_or_more.rb +0 -12
  196. data/meta/regexp/regexp_root_expression.rb +0 -10
  197. data/meta/restarg.rb +0 -10
  198. data/spec/support/fake_actor.rb +0 -111
  199. data/spec/support/warning.rb +0 -66
  200. data/spec/unit/mutant/actor/binding_spec.rb +0 -34
  201. data/spec/unit/mutant/actor/env_spec.rb +0 -31
  202. data/spec/unit/mutant/actor/mailbox_spec.rb +0 -28
  203. data/spec/unit/mutant/actor/message_spec.rb +0 -25
  204. data/spec/unit/mutant/actor/receiver_spec.rb +0 -58
  205. data/spec/unit/mutant/actor/sender_spec.rb +0 -24
  206. data/spec/unit/mutant/ast/regexp/parse_spec.rb +0 -19
  207. data/spec/unit/mutant/ast/regexp/transformer/lookup_table/table_spec.rb +0 -21
  208. data/spec/unit/mutant/ast/regexp/transformer/lookup_table_spec.rb +0 -35
  209. data/spec/unit/mutant/ast/regexp/transformer_spec.rb +0 -21
  210. data/spec/unit/mutant/ast/regexp_spec.rb +0 -704
  211. data/spec/unit/mutant/env/bootstrap_spec.rb +0 -188
  212. data/spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb +0 -26
  213. data/spec/unit/mutant/parallel/master_spec.rb +0 -338
  214. data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +0 -121
  215. data/spec/unit/mutant/reporter/cli/tput_spec.rb +0 -50
  216. data/spec/unit/mutant/warning_filter_spec.rb +0 -106
  217. data/spec/unit/mutant_spec.rb +0 -17
  218. data/test_app/Gemfile.rspec3.7 +0 -7
@@ -4,39 +4,44 @@ Mutant::Meta::Example.add :regexp do
4
4
  source '/foo/'
5
5
 
6
6
  singleton_mutations
7
- regexp_mutations
7
+
8
+ mutation '//'
9
+ mutation '/nomatch\A/'
8
10
  end
9
11
 
10
12
  Mutant::Meta::Example.add :regexp do
11
13
  source '/#{foo.bar}n/'
12
14
 
13
15
  singleton_mutations
14
- regexp_mutations
15
16
 
16
17
  mutation '/#{foo}n/'
17
- mutation '/#{self.bar}n/'
18
18
  mutation '/#{nil}n/'
19
+ mutation '/#{self.bar}n/'
19
20
  mutation '/#{self}n/'
21
+ mutation '//'
22
+ mutation '/nomatch\A/'
20
23
  end
21
24
 
22
25
  Mutant::Meta::Example.add :regexp do
23
26
  source '/#{foo}/'
24
27
 
25
28
  singleton_mutations
26
- regexp_mutations
27
29
 
28
30
  mutation '/#{self}/'
29
31
  mutation '/#{nil}/'
32
+ mutation '//'
33
+ mutation '/nomatch\A/'
30
34
  end
31
35
 
32
36
  Mutant::Meta::Example.add :regexp do
33
37
  source '/#{foo}#{nil}/'
34
38
 
35
39
  singleton_mutations
36
- regexp_mutations
37
40
 
38
41
  mutation '/#{nil}#{nil}/'
39
42
  mutation '/#{self}#{nil}/'
43
+ mutation '//'
44
+ mutation '/nomatch\A/'
40
45
  end
41
46
 
42
47
  Mutant::Meta::Example.add :regexp do
@@ -66,16 +71,6 @@ Mutant::Meta::Example.add :regexp do
66
71
  mutation 'true if /nomatch\A/'
67
72
  end
68
73
 
69
- Mutant::Meta::Example.add :regexp do
70
- source '/(?(1)(foo)(bar))/'
71
-
72
- singleton_mutations
73
- regexp_mutations
74
-
75
- mutation '/(?(1)(?:foo)(bar))/'
76
- mutation '/(?(1)(foo)(?:bar))/'
77
- end
78
-
79
74
  # Case where MRI would accept an expression but regexp_parser not.
80
75
  Mutant::Meta::Example.add :regexp do
81
76
  source '/u{/'
@@ -84,8 +79,3 @@ Mutant::Meta::Example.add :regexp do
84
79
  mutation '//'
85
80
  mutation '/nomatch\A/'
86
81
  end
87
-
88
- Pathname
89
- .glob(Pathname.new(__dir__).join('regexp', '*.rb'))
90
- .sort
91
- .each(&Kernel.public_method(:require))
@@ -137,13 +137,6 @@ Mutant::Meta::Example.add :send do
137
137
  mutation 'map'
138
138
  end
139
139
 
140
- Mutant::Meta::Example.add :send do
141
- source 'to_i'
142
-
143
- singleton_mutations
144
- mutation 'to_int'
145
- end
146
-
147
140
  Mutant::Meta::Example.add :send do
148
141
  source 'foo.to_s'
149
142
 
@@ -160,7 +153,6 @@ Mutant::Meta::Example.add :send do
160
153
  mutation 'foo'
161
154
  mutation 'self.to_a'
162
155
  mutation 'foo.to_ary'
163
- mutation 'foo.to_set'
164
156
  end
165
157
 
166
158
  Mutant::Meta::Example.add :send do
@@ -516,42 +508,6 @@ Mutant::Meta::Example.add :send do
516
508
  mutation '!a.equal?(b)'
517
509
  end
518
510
 
519
- Mutant::Meta::Example.add :send do
520
- source 'sample'
521
-
522
- singleton_mutations
523
- mutation 'first'
524
- mutation 'last'
525
- end
526
-
527
- Mutant::Meta::Example.add :send do
528
- source 'pop'
529
-
530
- singleton_mutations
531
- mutation 'last'
532
- end
533
-
534
- Mutant::Meta::Example.add :send do
535
- source 'shift'
536
-
537
- singleton_mutations
538
- mutation 'first'
539
- end
540
-
541
- Mutant::Meta::Example.add :send do
542
- source 'first'
543
-
544
- singleton_mutations
545
- mutation 'last'
546
- end
547
-
548
- Mutant::Meta::Example.add :send do
549
- source 'last'
550
-
551
- singleton_mutations
552
- mutation 'first'
553
- end
554
-
555
511
  Mutant::Meta::Example.add :send do
556
512
  source '!!foo'
557
513
 
@@ -619,7 +575,6 @@ Mutant::Meta::Example.add :send do
619
575
  mutation 'self =~ //'
620
576
  mutation '//'
621
577
  mutation 'a =~ /nomatch\A/'
622
- mutation 'a.match?(//)'
623
578
  end
624
579
 
625
580
  Mutant::Meta::Example.add :send do
@@ -630,7 +585,20 @@ Mutant::Meta::Example.add :send do
630
585
  mutation '//.match'
631
586
  mutation '//.match(nil)'
632
587
  mutation '//.match(self)'
633
- mutation '//.match?(a)'
634
588
  mutation '//'
635
589
  mutation '/nomatch\A/.match(a)'
636
590
  end
591
+
592
+ Mutant::Meta::Example.add :send do
593
+ source 'foo(bar { nil; nil })'
594
+
595
+ singleton_mutations
596
+ mutation 'bar { nil; nil }'
597
+ mutation 'foo'
598
+ mutation 'foo(bar { nil })'
599
+ mutation 'foo(bar { raise })'
600
+ mutation 'foo(bar {})'
601
+ mutation 'foo(bar)'
602
+ mutation 'foo(self)'
603
+ mutation 'foo(nil)'
604
+ end
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.description = 'Minitest integration for mutant'
11
11
  gem.summary = gem.description
12
12
  gem.homepage = 'https://github.com/mbj/mutant'
13
- gem.license = 'MIT'
13
+ gem.license = 'Nonstandard'
14
14
 
15
15
  gem.require_paths = %w[lib]
16
16
  gem.files = `git ls-files -- lib/mutant/{minitest,/integration/minitest.rb}`.split("\n")
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.description = 'Rspec integration for mutant'
11
11
  gem.summary = gem.description
12
12
  gem.homepage = 'https://github.com/mbj/mutant'
13
- gem.license = 'MIT'
13
+ gem.license = 'Nonstandard'
14
14
 
15
15
  gem.require_paths = %w[lib]
16
16
  gem.files = `git ls-files -- lib/mutant/integration/rspec.rb`.split("\n")
@@ -18,5 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.extra_rdoc_files = %w[LICENSE]
19
19
 
20
20
  gem.add_runtime_dependency('mutant', "~> #{gem.version}")
21
- gem.add_runtime_dependency('rspec-core', '>= 3.4.0', '< 4.0.0')
21
+ gem.add_runtime_dependency('rspec-core', '>= 3.8.0', '< 4.0.0')
22
22
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.description = 'Mutation testing for ruby'
11
11
  gem.summary = 'Mutation testing tool for ruby under MRI and Rubinius'
12
12
  gem.homepage = 'https://github.com/mbj/mutant'
13
- gem.license = 'MIT'
13
+ gem.license = 'Nonstandard'
14
14
 
15
15
  gem.require_paths = %w[lib]
16
16
 
@@ -21,21 +21,20 @@ Gem::Specification.new do |gem|
21
21
  gem.extra_rdoc_files = %w[LICENSE]
22
22
  gem.executables = %w[mutant]
23
23
 
24
- gem.add_runtime_dependency('abstract_type', '~> 0.0.7')
25
- gem.add_runtime_dependency('adamantium', '~> 0.2.0')
26
- gem.add_runtime_dependency('anima', '~> 0.3.0')
27
- gem.add_runtime_dependency('ast', '~> 2.2')
28
- gem.add_runtime_dependency('concord', '~> 0.1.5')
29
- gem.add_runtime_dependency('diff-lcs', '~> 1.3')
30
- gem.add_runtime_dependency('equalizer', '~> 0.0.9')
31
- gem.add_runtime_dependency('ice_nine', '~> 0.11.1')
32
- gem.add_runtime_dependency('memoizable', '~> 0.4.2')
33
- gem.add_runtime_dependency('morpher', '~> 0.2.6')
34
- gem.add_runtime_dependency('parser', '~> 2.5.1')
35
- gem.add_runtime_dependency('procto', '~> 0.0.2')
36
- gem.add_runtime_dependency('regexp_parser', '~> 1.2')
37
- gem.add_runtime_dependency('unparser', '~> 0.4.2')
24
+ gem.add_runtime_dependency('abstract_type', '~> 0.0.7')
25
+ gem.add_runtime_dependency('adamantium', '~> 0.2.0')
26
+ gem.add_runtime_dependency('anima', '~> 0.3.1')
27
+ gem.add_runtime_dependency('ast', '~> 2.2')
28
+ gem.add_runtime_dependency('concord', '~> 0.1.5')
29
+ gem.add_runtime_dependency('diff-lcs', '~> 1.3')
30
+ gem.add_runtime_dependency('equalizer', '~> 0.0.9')
31
+ gem.add_runtime_dependency('ice_nine', '~> 0.11.1')
32
+ gem.add_runtime_dependency('memoizable', '~> 0.4.2')
33
+ gem.add_runtime_dependency('mutant-license', '~> 0.1.0')
34
+ gem.add_runtime_dependency('parser', '= 2.6.3')
35
+ gem.add_runtime_dependency('procto', '~> 0.0.2')
36
+ gem.add_runtime_dependency('unparser', '~> 0.4.5')
38
37
 
39
- gem.add_development_dependency('devtools', '~> 0.1.22')
38
+ gem.add_development_dependency('devtools', '~> 0.1.23')
40
39
  gem.add_development_dependency('parallel', '~> 1.3')
41
40
  end
@@ -0,0 +1,6 @@
1
+ ---
2
+ includes:
3
+ - lib
4
+ integration: rspec
5
+ requires:
6
+ - mutant
@@ -1,11 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe Mutant::Isolation::Fork, mutant: false do
4
- # rubocop:disable Lint/AmbiguousBlockAssociation
5
- specify do
4
+ def apply(&block)
5
+ Mutant::Config::DEFAULT.isolation.call(&block)
6
+ end
7
+
8
+ it 'isolates local writes' do
6
9
  a = 1
7
- expect do
8
- Mutant::Config::DEFAULT.isolation.call { a = 2 }
9
- end.to_not change { a }
10
+
11
+ expect { apply { a = 2 } }.to_not(change { a }.from(1))
12
+ end
13
+
14
+ it 'captures console output' do
15
+ result = apply do
16
+ $stdout.puts('foo')
17
+ $stderr.puts('bar')
18
+ end
19
+
20
+ expect(result.log).to eql("foo\nbar\n")
21
+ end
22
+
23
+ it 'allows to read result' do
24
+ result = apply { :foo }
25
+
26
+ expect(result.value).to eql(:foo)
10
27
  end
11
28
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe 'minitest integration', mutant: false do
4
-
5
- let(:base_cmd) { 'bundle exec mutant -I test -I lib --require test_app --use minitest' }
4
+ let(:base_cmd) do
5
+ %w[bundle exec mutant -I test -I lib --require test_app --use minitest]
6
+ end
6
7
 
7
8
  let(:gemfile) { 'Gemfile.minitest' }
8
9
 
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe 'rspec integration', mutant: false do
4
+ let(:base_cmd) do
5
+ %w[bundle exec mutant -I lib --require test_app --use rspec]
6
+ end
4
7
 
5
- let(:base_cmd) { 'bundle exec mutant -I lib --require test_app --use rspec' }
6
-
7
- %w[3.7 3.8].each do |version|
8
+ %w[3.8].each do |version|
8
9
  context "RSpec #{version}" do
9
10
  let(:gemfile) { "Gemfile.rspec#{version}" }
10
11
 
@@ -4,55 +4,58 @@
4
4
  repo_uri: 'https://github.com/ruby/rubyspec.git'
5
5
  repo_ref: 'origin/master'
6
6
  integration: mspec
7
- ruby_glob_pattern: '**/*_spec.rb'
8
7
  mutation_coverage: false
9
8
  mutation_generation: true
10
- expected_errors:
11
- "#<ArgumentError: No valid target found for '?' >":
12
- - core/matchdata/begin_spec.rb
13
- - core/matchdata/end_spec.rb
14
9
  exclude:
10
+ - command_line/fixtures/bad_syntax.rb
11
+ - command_line/fixtures/freeze_flag_required_diff_enc.rb
12
+ - core/kernel/shared/sprintf_encoding.rb
13
+ - core/module/fixtures/autoload_empty.rb
14
+ - core/module/fixtures/autoload_never_set.rb
15
+ - core/module/fixtures/path2/load_path.rb
16
+ - core/regexp/shared/new.rb
15
17
  - core/string/casecmp_spec.rb
18
+ - core/string/encode_spec.rb
19
+ - core/string/inspect_spec.rb
20
+ - core/string/shared/to_sym.rb
16
21
  - core/symbol/casecmp_spec.rb
22
+ - language/fixtures/freeze_magic_comment_required_diff_enc.rb
23
+ - language/fixtures/utf16-be-nobom.rb
24
+ - language/fixtures/utf16-le-nobom.rb
25
+ - language/predefined/fixtures/data4.rb
26
+ - language/predefined/fixtures/data_only.rb
17
27
  - language/source_encoding_spec.rb
28
+ - library/base64/decode64_spec.rb
18
29
  - security/cve_2010_1330_spec.rb
19
30
  - name: regexp_parser
20
31
  namespace: Regexp
21
32
  repo_uri: 'https://github.com/ammar/regexp_parser.git'
22
33
  repo_ref: 'v1.2.0'
23
34
  integration: rspec
24
- ruby_glob_pattern: '**/*.rb'
25
35
  mutation_coverage: false
26
36
  mutation_generation: true
27
- expected_errors: {}
28
37
  exclude: []
29
38
  - name: auom
30
39
  namespace: AUOM
31
40
  repo_uri: 'https://github.com/mbj/auom.git'
32
41
  repo_ref: 'origin/master'
33
- ruby_glob_pattern: '**/*.rb'
34
42
  integration: rspec
35
43
  mutation_coverage: true
36
44
  mutation_generation: true
37
- expected_errors: {}
38
45
  exclude: []
39
46
  - name: auom
40
47
  namespace: AUOM
41
48
  repo_uri: 'https://github.com/mbj/auom.git'
42
49
  repo_ref: 'origin/master'
43
- ruby_glob_pattern: '**/*.rb'
44
50
  integration: minitest
45
51
  mutation_coverage: true
46
52
  mutation_generation: true
47
- expected_errors: {}
48
53
  exclude: []
49
54
  - name: axiom
50
55
  namespace: Axiom
51
56
  repo_uri: 'https://github.com/dkubb/axiom.git'
52
57
  repo_ref: 'origin/master'
53
- ruby_glob_pattern: '**/*.rb'
54
58
  integration: rspec
55
59
  mutation_coverage: false
56
60
  mutation_generation: true
57
- expected_errors: {}
58
61
  exclude: []
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples 'no block evaluation' do
4
+ context 'with block' do
5
+ let(:block) { -> { fail } }
6
+
7
+ it 'does not evaluate block' do
8
+ apply
9
+ end
10
+ end
11
+ end
12
+
13
+ RSpec.shared_examples 'requires block' do
14
+ context 'without block' do
15
+ let(:block) { nil }
16
+
17
+ specify do
18
+ expect { apply }.to raise_error(LocalJumpError)
19
+ end
20
+ end
21
+ end
22
+
23
+ RSpec.shared_examples 'returns self' do
24
+ it 'returns self' do
25
+ expect(apply).to be(subject)
26
+ end
27
+ end
28
+
29
+ RSpec.shared_examples '#apply block evaluation' do
30
+ it 'evaluates block and returns its wrapped result' do
31
+ expect { expect(apply).to eql(block_result) }
32
+ .to change(yields, :to_a)
33
+ .from([])
34
+ .to([value])
35
+ end
36
+ end
37
+
38
+ RSpec.shared_examples 'Functor#fmap block evaluation' do
39
+ it 'evaluates block and returns its wrapped result' do
40
+ expect { expect(apply).to eql(described_class.new(block_result)) }
41
+ .to change(yields, :to_a)
42
+ .from([])
43
+ .to([value])
44
+ end
45
+ end
@@ -2,7 +2,13 @@
2
2
 
3
3
  RSpec.shared_examples_for 'framework integration' do
4
4
  def system_with_gemfile(*command)
5
- Kernel.system({ 'BUNDLE_GEMFILE' => gemfile }, *command)
5
+ Kernel.system(
6
+ {
7
+ 'CI' => '1',
8
+ 'BUNDLE_GEMFILE' => gemfile
9
+ },
10
+ *command
11
+ )
6
12
  end
7
13
 
8
14
  around do |example|
@@ -14,28 +20,51 @@ RSpec.shared_examples_for 'framework integration' do
14
20
  end
15
21
  end
16
22
 
23
+ let(:effective_base_cmd) do
24
+ if ENV.key?('MUTANT_JOBS')
25
+ [*base_cmd, '--jobs', ENV.fetch('MUTANT_JOBS')]
26
+ else
27
+ base_cmd
28
+ end
29
+ end
30
+
17
31
  specify 'it allows to kill mutations' do
18
- expect(system_with_gemfile("#{base_cmd} TestApp::Literal#string")).to be(true)
32
+ expect(
33
+ system_with_gemfile(
34
+ *effective_base_cmd,
35
+ 'TestApp::Literal#string'
36
+ )
37
+ ).to be(true)
19
38
  end
20
39
 
21
40
  specify 'it allows to exclude mutations' do
22
- cli = <<-CMD.split("\n").join(' ')
23
- #{base_cmd}
24
- --ignore-subject TestApp::Literal#uncovered_string
25
- --
26
- TestApp::Literal#string
27
- TestApp::Literal#uncovered_string
28
- CMD
29
- expect(system_with_gemfile(cli)).to be(true)
41
+ expect(
42
+ system_with_gemfile(
43
+ *effective_base_cmd,
44
+ '--ignore-subject',
45
+ 'TestApp::Literal#uncovered_string',
46
+ '--',
47
+ 'TestApp::Literal#string',
48
+ 'TestApp::Literal#uncovered_string'
49
+ )
50
+ ).to be(true)
30
51
  end
31
52
 
32
53
  specify 'fails to kill mutations when they are not covered' do
33
- cli = "#{base_cmd} TestApp::Literal#uncovered_string"
34
- expect(system_with_gemfile(cli)).to be(false)
54
+ expect(
55
+ system_with_gemfile(
56
+ *effective_base_cmd,
57
+ 'TestApp::Literal#uncovered_string'
58
+ )
59
+ ).to be(false)
35
60
  end
36
61
 
37
62
  specify 'fails when some mutations are not covered' do
38
- cli = "#{base_cmd} TestApp::Literal"
39
- expect(system_with_gemfile(cli)).to be(false)
63
+ expect(
64
+ system_with_gemfile(
65
+ *effective_base_cmd,
66
+ 'TestApp::Literal'
67
+ )
68
+ ).to be(false)
40
69
  end
41
70
  end