mutant 0.9.8 → 0.9.9
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/Changelog.md +6 -0
- data/README.md +63 -23
- data/config/reek.yml +1 -0
- data/lib/mutant.rb +4 -0
- data/lib/mutant/ast.rb +0 -9
- data/lib/mutant/ast/find_metaclass_containing.rb +48 -0
- data/lib/mutant/ast/meta/send.rb +0 -6
- data/lib/mutant/bootstrap.rb +0 -36
- data/lib/mutant/cli.rb +5 -49
- data/lib/mutant/color.rb +0 -3
- data/lib/mutant/config.rb +0 -8
- data/lib/mutant/context.rb +0 -3
- data/lib/mutant/diff.rb +0 -17
- data/lib/mutant/env.rb +0 -6
- data/lib/mutant/expression/method.rb +6 -6
- data/lib/mutant/expression/methods.rb +6 -6
- data/lib/mutant/expression/parser.rb +0 -6
- data/lib/mutant/integration.rb +0 -18
- data/lib/mutant/isolation/fork.rb +0 -22
- data/lib/mutant/license.rb +11 -0
- data/lib/mutant/matcher.rb +0 -14
- data/lib/mutant/matcher/config.rb +0 -11
- data/lib/mutant/matcher/method.rb +0 -31
- data/lib/mutant/matcher/method/instance.rb +0 -8
- data/lib/mutant/matcher/method/metaclass.rb +86 -0
- data/lib/mutant/matcher/method/singleton.rb +0 -25
- data/lib/mutant/matcher/methods.rb +17 -28
- data/lib/mutant/matcher/namespace.rb +0 -10
- data/lib/mutant/matcher/scope.rb +2 -4
- data/lib/mutant/meta/example/dsl.rb +0 -21
- data/lib/mutant/meta/example/verification.rb +0 -20
- data/lib/mutant/mutation.rb +0 -3
- data/lib/mutant/mutator.rb +1 -29
- data/lib/mutant/mutator/node.rb +1 -66
- data/lib/mutant/mutator/node/and_asgn.rb +0 -3
- data/lib/mutant/mutator/node/argument.rb +0 -15
- data/lib/mutant/mutator/node/arguments.rb +0 -20
- data/lib/mutant/mutator/node/begin.rb +0 -3
- data/lib/mutant/mutator/node/binary.rb +0 -23
- data/lib/mutant/mutator/node/block.rb +0 -15
- data/lib/mutant/mutator/node/break.rb +0 -3
- data/lib/mutant/mutator/node/case.rb +0 -9
- data/lib/mutant/mutator/node/class.rb +0 -3
- data/lib/mutant/mutator/node/conditional_loop.rb +0 -3
- data/lib/mutant/mutator/node/const.rb +0 -3
- data/lib/mutant/mutator/node/define.rb +0 -11
- data/lib/mutant/mutator/node/defined.rb +0 -3
- data/lib/mutant/mutator/node/dstr.rb +0 -3
- data/lib/mutant/mutator/node/dsym.rb +0 -3
- data/lib/mutant/mutator/node/generic.rb +0 -3
- data/lib/mutant/mutator/node/if.rb +0 -12
- data/lib/mutant/mutator/node/index.rb +0 -27
- data/lib/mutant/mutator/node/kwbegin.rb +0 -3
- data/lib/mutant/mutator/node/literal.rb +0 -3
- data/lib/mutant/mutator/node/literal/array.rb +0 -6
- data/lib/mutant/mutator/node/literal/boolean.rb +0 -4
- data/lib/mutant/mutator/node/literal/float.rb +0 -9
- data/lib/mutant/mutator/node/literal/hash.rb +0 -9
- data/lib/mutant/mutator/node/literal/integer.rb +0 -9
- data/lib/mutant/mutator/node/literal/nil.rb +0 -3
- data/lib/mutant/mutator/node/literal/range.rb +0 -6
- data/lib/mutant/mutator/node/literal/regex.rb +0 -6
- data/lib/mutant/mutator/node/literal/string.rb +0 -3
- data/lib/mutant/mutator/node/literal/symbol.rb +0 -3
- data/lib/mutant/mutator/node/masgn.rb +0 -3
- data/lib/mutant/mutator/node/match_current_line.rb +0 -3
- data/lib/mutant/mutator/node/mlhs.rb +0 -3
- data/lib/mutant/mutator/node/named_value/access.rb +2 -14
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +0 -9
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -6
- data/lib/mutant/mutator/node/next.rb +0 -3
- data/lib/mutant/mutator/node/noop.rb +0 -3
- data/lib/mutant/mutator/node/nthref.rb +0 -3
- data/lib/mutant/mutator/node/op_asgn.rb +0 -3
- data/lib/mutant/mutator/node/or_asgn.rb +0 -3
- data/lib/mutant/mutator/node/procarg_zero.rb +0 -3
- data/lib/mutant/mutator/node/regopt.rb +0 -6
- data/lib/mutant/mutator/node/resbody.rb +0 -6
- data/lib/mutant/mutator/node/rescue.rb +2 -19
- data/lib/mutant/mutator/node/return.rb +0 -3
- data/lib/mutant/mutator/node/sclass.rb +20 -0
- data/lib/mutant/mutator/node/send.rb +2 -61
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -9
- data/lib/mutant/mutator/node/send/binary.rb +0 -11
- data/lib/mutant/mutator/node/send/conditional.rb +0 -3
- data/lib/mutant/mutator/node/splat.rb +0 -3
- data/lib/mutant/mutator/node/super.rb +0 -3
- data/lib/mutant/mutator/node/when.rb +0 -19
- data/lib/mutant/mutator/node/yield.rb +0 -3
- data/lib/mutant/mutator/node/zsuper.rb +0 -3
- data/lib/mutant/mutator/util/array.rb +0 -6
- data/lib/mutant/mutator/util/symbol.rb +0 -3
- data/lib/mutant/parallel.rb +0 -13
- data/lib/mutant/parallel/driver.rb +0 -10
- data/lib/mutant/parallel/worker.rb +0 -22
- data/lib/mutant/reporter/cli.rb +0 -5
- data/lib/mutant/reporter/cli/format.rb +0 -9
- data/lib/mutant/reporter/cli/printer.rb +0 -40
- data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -15
- data/lib/mutant/reporter/cli/printer/isolation_result.rb +0 -18
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -5
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -21
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -8
- data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -9
- data/lib/mutant/repository/diff.rb +1 -13
- data/lib/mutant/repository/diff/ranges.rb +0 -11
- data/lib/mutant/result.rb +0 -3
- data/lib/mutant/runner.rb +0 -18
- data/lib/mutant/runner/sink.rb +0 -5
- data/lib/mutant/subject.rb +0 -8
- data/lib/mutant/subject/method.rb +0 -3
- data/lib/mutant/subject/method/instance.rb +0 -5
- data/lib/mutant/subject/method/metaclass.rb +30 -0
- data/lib/mutant/transform.rb +0 -92
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warnings.rb +0 -6
- data/lib/mutant/zombifier.rb +2 -34
- data/meta/and.rb +0 -2
- data/meta/array.rb +0 -3
- data/meta/begin.rb +0 -3
- data/meta/block.rb +0 -3
- data/meta/break.rb +0 -1
- data/meta/case.rb +0 -6
- data/meta/casgn.rb +0 -3
- data/meta/cvasgn.rb +0 -1
- data/meta/def.rb +0 -7
- data/meta/ensure.rb +0 -1
- data/meta/false.rb +0 -1
- data/meta/gvasgn.rb +0 -1
- data/meta/hash.rb +0 -4
- data/meta/if.rb +0 -5
- data/meta/ivasgn.rb +0 -1
- data/meta/kwbegin.rb +0 -1
- data/meta/lvasgn.rb +0 -1
- data/meta/match_current_line.rb +0 -1
- data/meta/next.rb +0 -1
- data/meta/or.rb +0 -2
- data/meta/regexp.rb +0 -1
- data/meta/rescue.rb +0 -6
- data/meta/sclass.rb +12 -0
- data/meta/send.rb +0 -4
- data/meta/true.rb +0 -1
- data/meta/until.rb +0 -1
- data/meta/while.rb +0 -2
- data/meta/yield.rb +0 -1
- data/mutant.sh +12 -0
- data/spec/unit/mutant/ast/find_metaclass_containing_spec.rb +64 -0
- data/spec/unit/mutant/expression/methods_spec.rb +7 -2
- data/spec/unit/mutant/license_spec.rb +15 -3
- data/spec/unit/mutant/matcher/method/metaclass_spec.rb +108 -0
- data/spec/unit/mutant/matcher/methods/metaclass_spec.rb +62 -0
- data/spec/unit/mutant/matcher/namespace_spec.rb +3 -1
- data/spec/unit/mutant/matcher/scope_spec.rb +11 -1
- data/spec/unit/mutant/meta/example_spec.rb +3 -3
- data/spec/unit/mutant/mutator/node_spec.rb +1 -6
- data/spec/unit/mutant/subject/method/metaclass_spec.rb +63 -0
- data/test_app/lib/test_app.rb +1 -0
- data/test_app/lib/test_app/metaclasses.rb +108 -0
- metadata +17 -2
data/test_app/lib/test_app.rb
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TestApp
|
|
4
|
+
module MetaclassMethodTests
|
|
5
|
+
module DefinedOnSelf
|
|
6
|
+
class << self
|
|
7
|
+
def foo; end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# again this is a weird edge-case that's being checked for consistent
|
|
11
|
+
# behaviour, not something that people ought to be doing.
|
|
12
|
+
module InsideMetaclass
|
|
13
|
+
class << self
|
|
14
|
+
# some older versions of ruby don't have Object#singleton_class,
|
|
15
|
+
# this is just an implementation of that so we can grab
|
|
16
|
+
# InsideMetaclass.metaclass for use as the scope object
|
|
17
|
+
def metaclass
|
|
18
|
+
class << self
|
|
19
|
+
self
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# InsideMetaclass.foo
|
|
24
|
+
def foo; end
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
# #<Class:InsideMetaclass>.foo
|
|
28
|
+
def foo; end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
module DefinedOnLvar
|
|
35
|
+
a = self
|
|
36
|
+
class << a
|
|
37
|
+
def foo; end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
module DefinedOnConstant
|
|
42
|
+
module InsideNamespace
|
|
43
|
+
class << InsideNamespace
|
|
44
|
+
def foo; end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
module OutsideNamespace
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class << OutsideNamespace
|
|
52
|
+
def foo
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
module DefinedMultipleTimes
|
|
58
|
+
module DifferentLines
|
|
59
|
+
class << self
|
|
60
|
+
def foo
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def foo(_arg)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
module SameLine
|
|
69
|
+
module SameScope
|
|
70
|
+
class << self
|
|
71
|
+
def foo; end; def foo(_arg); end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
module DifferentScope
|
|
76
|
+
class << self; def foo; end; end; class << DifferentScope; def foo(_arg); end; end; class << MetaclassMethodTests; def foo; end; end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
module DifferentName
|
|
80
|
+
class << self; def foo; end; def bar(_arg); end; end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
module NotActuallyInAMetaclass
|
|
86
|
+
class << self
|
|
87
|
+
# some older versions of ruby don't have Object#singleton_class,
|
|
88
|
+
# this is just an implementation of that so we can grab
|
|
89
|
+
# InsideMetaclass.metaclass for use as the scope object
|
|
90
|
+
def metaclass
|
|
91
|
+
class << self
|
|
92
|
+
self
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# this is a very weird construction that I do not recommend.
|
|
97
|
+
# to access SomeClass you have to do
|
|
98
|
+
# NotActuallyInAMetaclass.singleton_class::SomeClass. Very weird
|
|
99
|
+
# This is only here so we can test that metaclass_receiver? correctly
|
|
100
|
+
# returns false
|
|
101
|
+
class SomeClass
|
|
102
|
+
def foo
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
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.9.
|
|
4
|
+
version: 0.9.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Markus Schirp
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-08-
|
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: abstract_type
|
|
@@ -270,6 +270,7 @@ files:
|
|
|
270
270
|
- docs/reading-reports.md
|
|
271
271
|
- lib/mutant.rb
|
|
272
272
|
- lib/mutant/ast.rb
|
|
273
|
+
- lib/mutant/ast/find_metaclass_containing.rb
|
|
273
274
|
- lib/mutant/ast/meta.rb
|
|
274
275
|
- lib/mutant/ast/meta/const.rb
|
|
275
276
|
- lib/mutant/ast/meta/optarg.rb
|
|
@@ -309,6 +310,7 @@ files:
|
|
|
309
310
|
- lib/mutant/matcher/filter.rb
|
|
310
311
|
- lib/mutant/matcher/method.rb
|
|
311
312
|
- lib/mutant/matcher/method/instance.rb
|
|
313
|
+
- lib/mutant/matcher/method/metaclass.rb
|
|
312
314
|
- lib/mutant/matcher/method/singleton.rb
|
|
313
315
|
- lib/mutant/matcher/methods.rb
|
|
314
316
|
- lib/mutant/matcher/namespace.rb
|
|
@@ -368,6 +370,7 @@ files:
|
|
|
368
370
|
- lib/mutant/mutator/node/resbody.rb
|
|
369
371
|
- lib/mutant/mutator/node/rescue.rb
|
|
370
372
|
- lib/mutant/mutator/node/return.rb
|
|
373
|
+
- lib/mutant/mutator/node/sclass.rb
|
|
371
374
|
- lib/mutant/mutator/node/send.rb
|
|
372
375
|
- lib/mutant/mutator/node/send/attribute_assignment.rb
|
|
373
376
|
- lib/mutant/mutator/node/send/binary.rb
|
|
@@ -418,6 +421,7 @@ files:
|
|
|
418
421
|
- lib/mutant/subject.rb
|
|
419
422
|
- lib/mutant/subject/method.rb
|
|
420
423
|
- lib/mutant/subject/method/instance.rb
|
|
424
|
+
- lib/mutant/subject/method/metaclass.rb
|
|
421
425
|
- lib/mutant/subject/method/singleton.rb
|
|
422
426
|
- lib/mutant/test.rb
|
|
423
427
|
- lib/mutant/timer.rb
|
|
@@ -481,6 +485,7 @@ files:
|
|
|
481
485
|
- meta/regopt.rb
|
|
482
486
|
- meta/rescue.rb
|
|
483
487
|
- meta/return.rb
|
|
488
|
+
- meta/sclass.rb
|
|
484
489
|
- meta/self.rb
|
|
485
490
|
- meta/send.rb
|
|
486
491
|
- meta/str.rb
|
|
@@ -493,6 +498,7 @@ files:
|
|
|
493
498
|
- mutant-minitest.gemspec
|
|
494
499
|
- mutant-rspec.gemspec
|
|
495
500
|
- mutant.gemspec
|
|
501
|
+
- mutant.sh
|
|
496
502
|
- mutant.yml
|
|
497
503
|
- spec/integration/mutant/corpus_spec.rb
|
|
498
504
|
- spec/integration/mutant/isolation/fork_spec.rb
|
|
@@ -513,6 +519,7 @@ files:
|
|
|
513
519
|
- spec/support/test_app.rb
|
|
514
520
|
- spec/support/warnings.yml
|
|
515
521
|
- spec/support/xspec.rb
|
|
522
|
+
- spec/unit/mutant/ast/find_metaclass_containing_spec.rb
|
|
516
523
|
- spec/unit/mutant/ast/meta/optarg_spec.rb
|
|
517
524
|
- spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
|
|
518
525
|
- spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
|
|
@@ -545,8 +552,10 @@ files:
|
|
|
545
552
|
- spec/unit/mutant/matcher/config_spec.rb
|
|
546
553
|
- spec/unit/mutant/matcher/filter_spec.rb
|
|
547
554
|
- spec/unit/mutant/matcher/method/instance_spec.rb
|
|
555
|
+
- spec/unit/mutant/matcher/method/metaclass_spec.rb
|
|
548
556
|
- spec/unit/mutant/matcher/method/singleton_spec.rb
|
|
549
557
|
- spec/unit/mutant/matcher/methods/instance_spec.rb
|
|
558
|
+
- spec/unit/mutant/matcher/methods/metaclass_spec.rb
|
|
550
559
|
- spec/unit/mutant/matcher/methods/singleton_spec.rb
|
|
551
560
|
- spec/unit/mutant/matcher/namespace_spec.rb
|
|
552
561
|
- spec/unit/mutant/matcher/null_spec.rb
|
|
@@ -595,6 +604,7 @@ files:
|
|
|
595
604
|
- spec/unit/mutant/selector/expression_spec.rb
|
|
596
605
|
- spec/unit/mutant/selector/null_spec.rb
|
|
597
606
|
- spec/unit/mutant/subject/method/instance_spec.rb
|
|
607
|
+
- spec/unit/mutant/subject/method/metaclass_spec.rb
|
|
598
608
|
- spec/unit/mutant/subject/method/singleton_spec.rb
|
|
599
609
|
- spec/unit/mutant/subject_spec.rb
|
|
600
610
|
- spec/unit/mutant/transform/array_spec.rb
|
|
@@ -615,6 +625,7 @@ files:
|
|
|
615
625
|
- test_app/Gemfile.rspec3.8
|
|
616
626
|
- test_app/lib/test_app.rb
|
|
617
627
|
- test_app/lib/test_app/literal.rb
|
|
628
|
+
- test_app/lib/test_app/metaclasses.rb
|
|
618
629
|
- test_app/spec/spec_helper.rb
|
|
619
630
|
- test_app/spec/unit/test_app/literal_spec.rb
|
|
620
631
|
- test_app/test/unit/test_app/literal_test.rb
|
|
@@ -648,6 +659,7 @@ test_files:
|
|
|
648
659
|
- spec/integration/mutant/null_spec.rb
|
|
649
660
|
- spec/integration/mutant/rspec_spec.rb
|
|
650
661
|
- spec/integration/mutant/test_mutator_handles_types_spec.rb
|
|
662
|
+
- spec/unit/mutant/ast/find_metaclass_containing_spec.rb
|
|
651
663
|
- spec/unit/mutant/ast/meta/optarg_spec.rb
|
|
652
664
|
- spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
|
|
653
665
|
- spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
|
|
@@ -680,8 +692,10 @@ test_files:
|
|
|
680
692
|
- spec/unit/mutant/matcher/config_spec.rb
|
|
681
693
|
- spec/unit/mutant/matcher/filter_spec.rb
|
|
682
694
|
- spec/unit/mutant/matcher/method/instance_spec.rb
|
|
695
|
+
- spec/unit/mutant/matcher/method/metaclass_spec.rb
|
|
683
696
|
- spec/unit/mutant/matcher/method/singleton_spec.rb
|
|
684
697
|
- spec/unit/mutant/matcher/methods/instance_spec.rb
|
|
698
|
+
- spec/unit/mutant/matcher/methods/metaclass_spec.rb
|
|
685
699
|
- spec/unit/mutant/matcher/methods/singleton_spec.rb
|
|
686
700
|
- spec/unit/mutant/matcher/namespace_spec.rb
|
|
687
701
|
- spec/unit/mutant/matcher/null_spec.rb
|
|
@@ -730,6 +744,7 @@ test_files:
|
|
|
730
744
|
- spec/unit/mutant/selector/expression_spec.rb
|
|
731
745
|
- spec/unit/mutant/selector/null_spec.rb
|
|
732
746
|
- spec/unit/mutant/subject/method/instance_spec.rb
|
|
747
|
+
- spec/unit/mutant/subject/method/metaclass_spec.rb
|
|
733
748
|
- spec/unit/mutant/subject/method/singleton_spec.rb
|
|
734
749
|
- spec/unit/mutant/subject_spec.rb
|
|
735
750
|
- spec/unit/mutant/transform/array_spec.rb
|