mutant 0.15.1 → 0.16.0

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/mutant/cli/command/root.rb +1 -1
  4. data/lib/mutant/cli/command/session.rb +281 -0
  5. data/lib/mutant/cli/command.rb +16 -2
  6. data/lib/mutant/config.rb +1 -1
  7. data/lib/mutant/expression/method.rb +0 -2
  8. data/lib/mutant/expression/methods.rb +0 -2
  9. data/lib/mutant/expression/namespace.rb +0 -2
  10. data/lib/mutant/isolation/fork.rb +2 -6
  11. data/lib/mutant/isolation.rb +31 -0
  12. data/lib/mutant/matcher/null.rb +1 -1
  13. data/lib/mutant/mutation/runner/sink.rb +23 -10
  14. data/lib/mutant/mutation/runner.rb +1 -0
  15. data/lib/mutant/mutation.rb +3 -20
  16. data/lib/mutant/mutator/node/literal/integer.rb +61 -0
  17. data/lib/mutant/parallel/connection.rb +0 -2
  18. data/lib/mutant/parallel/driver.rb +0 -2
  19. data/lib/mutant/reporter/cli/printer/alive_results.rb +27 -0
  20. data/lib/mutant/reporter/cli/printer/env_result.rb +52 -9
  21. data/lib/mutant/reporter/cli/printer/subject_result.rb +103 -5
  22. data/lib/mutant/reporter/cli/printer.rb +24 -1
  23. data/lib/mutant/repository/diff.rb +1 -2
  24. data/lib/mutant/result/exception.rb +29 -0
  25. data/lib/mutant/result/json_writer.rb +43 -0
  26. data/lib/mutant/result/process_status.rb +37 -0
  27. data/lib/mutant/result/session.rb +63 -0
  28. data/lib/mutant/result/test.rb +30 -0
  29. data/lib/mutant/result.rb +201 -96
  30. data/lib/mutant/segment/recorder.rb +0 -2
  31. data/lib/mutant/timer.rb +3 -1
  32. data/lib/mutant/transform/json.rb +68 -0
  33. data/lib/mutant/transform.rb +33 -25
  34. data/lib/mutant/world.rb +6 -0
  35. data/lib/mutant/zombifier.rb +0 -2
  36. data/lib/mutant.rb +13 -4
  37. metadata +33 -7
  38. data/lib/mutant/reporter/cli/printer/coverage_result.rb +0 -19
  39. data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -84
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.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
@@ -71,6 +71,20 @@ dependencies:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
73
  version: '2.10'
74
+ - !ruby/object:Gem::Dependency
75
+ name: securerandom
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0.3'
81
+ type: :runtime
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0.3'
74
88
  - !ruby/object:Gem::Dependency
75
89
  name: sorbet-runtime
76
90
  requirement: !ruby/object:Gem::Requirement
@@ -89,16 +103,22 @@ dependencies:
89
103
  name: unparser
90
104
  requirement: !ruby/object:Gem::Requirement
91
105
  requirements:
92
- - - "~>"
106
+ - - ">="
93
107
  - !ruby/object:Gem::Version
94
108
  version: 0.8.2
109
+ - - "<"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.10'
95
112
  type: :runtime
96
113
  prerelease: false
97
114
  version_requirements: !ruby/object:Gem::Requirement
98
115
  requirements:
99
- - - "~>"
116
+ - - ">="
100
117
  - !ruby/object:Gem::Version
101
118
  version: 0.8.2
119
+ - - "<"
120
+ - !ruby/object:Gem::Version
121
+ version: '0.10'
102
122
  - !ruby/object:Gem::Dependency
103
123
  name: rspec
104
124
  requirement: !ruby/object:Gem::Requirement
@@ -211,6 +231,7 @@ files:
211
231
  - lib/mutant/cli/command/environment/subject.rb
212
232
  - lib/mutant/cli/command/environment/test.rb
213
233
  - lib/mutant/cli/command/root.rb
234
+ - lib/mutant/cli/command/session.rb
214
235
  - lib/mutant/cli/command/util.rb
215
236
  - lib/mutant/config.rb
216
237
  - lib/mutant/config/coverage_criteria.rb
@@ -342,14 +363,13 @@ files:
342
363
  - lib/mutant/reporter/cli.rb
343
364
  - lib/mutant/reporter/cli/format.rb
344
365
  - lib/mutant/reporter/cli/printer.rb
366
+ - lib/mutant/reporter/cli/printer/alive_results.rb
345
367
  - lib/mutant/reporter/cli/printer/config.rb
346
- - lib/mutant/reporter/cli/printer/coverage_result.rb
347
368
  - lib/mutant/reporter/cli/printer/env.rb
348
369
  - lib/mutant/reporter/cli/printer/env_progress.rb
349
370
  - lib/mutant/reporter/cli/printer/env_result.rb
350
371
  - lib/mutant/reporter/cli/printer/isolation_result.rb
351
372
  - lib/mutant/reporter/cli/printer/mutation.rb
352
- - lib/mutant/reporter/cli/printer/mutation_result.rb
353
373
  - lib/mutant/reporter/cli/printer/status_progressive.rb
354
374
  - lib/mutant/reporter/cli/printer/subject_result.rb
355
375
  - lib/mutant/reporter/cli/printer/test.rb
@@ -361,6 +381,11 @@ files:
361
381
  - lib/mutant/repository/diff/ranges.rb
362
382
  - lib/mutant/require_highjack.rb
363
383
  - lib/mutant/result.rb
384
+ - lib/mutant/result/exception.rb
385
+ - lib/mutant/result/json_writer.rb
386
+ - lib/mutant/result/process_status.rb
387
+ - lib/mutant/result/session.rb
388
+ - lib/mutant/result/test.rb
364
389
  - lib/mutant/scope.rb
365
390
  - lib/mutant/segment.rb
366
391
  - lib/mutant/segment/recorder.rb
@@ -378,6 +403,7 @@ files:
378
403
  - lib/mutant/test/runner/sink.rb
379
404
  - lib/mutant/timer.rb
380
405
  - lib/mutant/transform.rb
406
+ - lib/mutant/transform/json.rb
381
407
  - lib/mutant/usage.rb
382
408
  - lib/mutant/util.rb
383
409
  - lib/mutant/variable.rb
@@ -397,14 +423,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
397
423
  requirements:
398
424
  - - ">="
399
425
  - !ruby/object:Gem::Version
400
- version: '3.2'
426
+ version: '3.3'
401
427
  required_rubygems_version: !ruby/object:Gem::Requirement
402
428
  requirements:
403
429
  - - ">="
404
430
  - !ruby/object:Gem::Version
405
431
  version: '0'
406
432
  requirements: []
407
- rubygems_version: 4.0.3
433
+ rubygems_version: 3.6.9
408
434
  specification_version: 4
409
435
  summary: ''
410
436
  test_files: []
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mutant
4
- class Reporter
5
- class CLI
6
- class Printer
7
- # Reporter for mutation coverage results
8
- class CoverageResult < self
9
- # Run report printer
10
- #
11
- # @return [undefined]
12
- def run
13
- visit(MutationResult, object.mutation_result)
14
- end
15
- end # Printer
16
- end # Coverage
17
- end # CLI
18
- end # Reporter
19
- end # Mutant
@@ -1,84 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mutant
4
- class Reporter
5
- class CLI
6
- class Printer
7
- # Reporter for mutation results
8
- class MutationResult < self
9
-
10
- delegate :mutation, :isolation_result
11
-
12
- MAP = {
13
- Mutant::Mutation::Evil => :evil_details,
14
- Mutant::Mutation::Neutral => :neutral_details,
15
- Mutant::Mutation::Noop => :noop_details
16
- }.freeze
17
-
18
- NEUTRAL_MESSAGE = <<~'MESSAGE'
19
- --- Neutral failure ---
20
- Original code was inserted unmutated. And the test did NOT PASS.
21
- Your tests do not pass initially or you found a bug in mutant / unparser.
22
- Subject AST:
23
- %s
24
- Unparsed Source:
25
- %s
26
- MESSAGE
27
-
28
- NO_DIFF_MESSAGE = <<~'MESSAGE'
29
- --- Internal failure ---
30
- BUG: A generated mutation did not result in exactly one diff hunk!
31
- This is an invariant violation by the mutation generation engine.
32
- Please report a reproduction to https://github.com/mbj/mutant
33
- Original unparsed source:
34
- %s
35
- Original AST:
36
- %s
37
- Mutated unparsed source:
38
- %s
39
- Mutated AST:
40
- %s
41
- MESSAGE
42
-
43
- NOOP_MESSAGE = <<~'MESSAGE'
44
- ---- Noop failure -----
45
- No code was inserted. And the test did NOT PASS.
46
- This is typically a problem of your specs not passing unmutated.
47
- MESSAGE
48
-
49
- SEPARATOR = '-----------------------'
50
-
51
- # Run report printer
52
- #
53
- # @return [undefined]
54
- def run
55
- puts(mutation.identification)
56
- puts(SEPARATOR)
57
- print_details
58
- puts(SEPARATOR)
59
- end
60
-
61
- private
62
-
63
- def print_details
64
- visit(IsolationResult, isolation_result)
65
- __send__(MAP.fetch(mutation.class))
66
- end
67
-
68
- def evil_details
69
- visit(Mutation, mutation)
70
- end
71
-
72
- def noop_details
73
- info(NOOP_MESSAGE)
74
- end
75
-
76
- def neutral_details
77
- info(NEUTRAL_MESSAGE, mutation.node.inspect, mutation.source)
78
- end
79
-
80
- end # MutationResult
81
- end # Printer
82
- end # CLI
83
- end # Reporter
84
- end # Mutant