mutant 0.8.7 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +5 -0
  3. data/README.md +64 -3
  4. data/config/flay.yml +1 -1
  5. data/lib/mutant.rb +2 -0
  6. data/lib/mutant/cli.rb +1 -1
  7. data/lib/mutant/env/bootstrap.rb +36 -8
  8. data/lib/mutant/expression/method.rb +3 -5
  9. data/lib/mutant/expression/methods.rb +2 -4
  10. data/lib/mutant/expression/namespace.rb +4 -8
  11. data/lib/mutant/matcher.rb +3 -18
  12. data/lib/mutant/matcher/chain.rb +7 -13
  13. data/lib/mutant/matcher/compiler.rb +2 -13
  14. data/lib/mutant/matcher/filter.rb +6 -19
  15. data/lib/mutant/matcher/method.rb +124 -104
  16. data/lib/mutant/matcher/method/instance.rb +40 -34
  17. data/lib/mutant/matcher/method/singleton.rb +80 -61
  18. data/lib/mutant/matcher/methods.rb +19 -29
  19. data/lib/mutant/matcher/namespace.rb +22 -16
  20. data/lib/mutant/matcher/null.rb +4 -7
  21. data/lib/mutant/matcher/scope.rb +23 -13
  22. data/lib/mutant/matcher/static.rb +17 -0
  23. data/lib/mutant/mutation.rb +0 -5
  24. data/lib/mutant/reporter/cli/format.rb +2 -3
  25. data/lib/mutant/reporter/cli/printer/env_progress.rb +37 -11
  26. data/lib/mutant/reporter/cli/printer/status_progressive.rb +1 -1
  27. data/lib/mutant/scope.rb +6 -0
  28. data/lib/mutant/subject/method.rb +0 -7
  29. data/lib/mutant/subject/method/instance.rb +0 -10
  30. data/lib/mutant/subject/method/singleton.rb +0 -10
  31. data/lib/mutant/version.rb +1 -1
  32. data/lib/mutant/zombifier.rb +2 -1
  33. data/mutant-rspec.gemspec +1 -1
  34. data/spec/integration/mutant/rspec_spec.rb +1 -1
  35. data/spec/shared/method_matcher_behavior.rb +21 -14
  36. data/spec/spec_helper.rb +6 -0
  37. data/spec/unit/mutant/env/boostrap_spec.rb +88 -26
  38. data/spec/unit/mutant/env_spec.rb +0 -1
  39. data/spec/unit/mutant/expression/method_spec.rb +3 -3
  40. data/spec/unit/mutant/expression/methods_spec.rb +3 -4
  41. data/spec/unit/mutant/expression/namespace/flat_spec.rb +2 -3
  42. data/spec/unit/mutant/expression/namespace/recursive_spec.rb +2 -4
  43. data/spec/unit/mutant/matcher/chain_spec.rb +21 -29
  44. data/spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb +16 -13
  45. data/spec/unit/mutant/matcher/compiler_spec.rb +49 -60
  46. data/spec/unit/mutant/matcher/filter_spec.rb +15 -31
  47. data/spec/unit/mutant/matcher/method/instance_spec.rb +84 -128
  48. data/spec/unit/mutant/matcher/method/singleton_spec.rb +48 -52
  49. data/spec/unit/mutant/matcher/methods/instance_spec.rb +21 -24
  50. data/spec/unit/mutant/matcher/methods/singleton_spec.rb +18 -21
  51. data/spec/unit/mutant/matcher/namespace_spec.rb +30 -38
  52. data/spec/unit/mutant/matcher/null_spec.rb +5 -20
  53. data/spec/unit/mutant/matcher/scope_spec.rb +33 -0
  54. data/spec/unit/mutant/matcher/static_spec.rb +11 -0
  55. data/spec/unit/mutant/mutation_spec.rb +30 -10
  56. data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +6 -0
  57. data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +2 -0
  58. data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +10 -0
  59. data/spec/unit/mutant/reporter/cli_spec.rb +4 -0
  60. data/spec/unit/mutant/subject/method/instance_spec.rb +0 -28
  61. data/spec/unit/mutant/subject/method/singleton_spec.rb +0 -28
  62. data/test_app/Gemfile.rspec3.4 +7 -0
  63. data/test_app/lib/test_app.rb +16 -12
  64. data/test_app/lib/test_app/literal.rb +3 -0
  65. metadata +9 -2
@@ -19,11 +19,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
19
19
  Requires: []
20
20
  Subjects: 1
21
21
  Mutations: 2
22
+ Results: 0
22
23
  Kills: 0
23
24
  Alive: 0
24
25
  Runtime: 4.00s
25
26
  Killtime: 0.00s
26
27
  Overhead: Inf%
28
+ Mutations/s: 0.00
27
29
  Coverage: 100.00%
28
30
  Expected: 10.00%
29
31
  STR
@@ -40,11 +42,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
40
42
  Requires: []
41
43
  Subjects: 1
42
44
  Mutations: 2
45
+ Results: 2
43
46
  Kills: 2
44
47
  Alive: 0
45
48
  Runtime: 4.00s
46
49
  Killtime: 2.00s
47
50
  Overhead: 100.00%
51
+ Mutations/s: 0.50
48
52
  Coverage: 100.00%
49
53
  Expected: 10.00%
50
54
  STR
@@ -63,11 +67,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
63
67
  Requires: []
64
68
  Subjects: 1
65
69
  Mutations: 2
70
+ Results: 2
66
71
  Kills: 1
67
72
  Alive: 1
68
73
  Runtime: 4.00s
69
74
  Killtime: 2.00s
70
75
  Overhead: 100.00%
76
+ Mutations/s: 0.50
71
77
  Coverage: 50.00%
72
78
  Expected: 10.00%
73
79
  STR
@@ -23,11 +23,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvResult do
23
23
  Requires: []
24
24
  Subjects: 1
25
25
  Mutations: 2
26
+ Results: 2
26
27
  Kills: 1
27
28
  Alive: 1
28
29
  Runtime: 4.00s
29
30
  Killtime: 2.00s
30
31
  Overhead: 100.00%
32
+ Mutations/s: 0.50
31
33
  Coverage: 50.00%
32
34
  Expected: 100.00%
33
35
  STR
@@ -17,11 +17,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
17
17
  Requires: []
18
18
  Subjects: 1
19
19
  Mutations: 2
20
+ Results: 0
20
21
  Kills: 0
21
22
  Alive: 0
22
23
  Runtime: 4.00s
23
24
  Killtime: 0.00s
24
25
  Overhead: Inf%
26
+ Mutations/s: 0.00
25
27
  Coverage: 100.00%
26
28
  Expected: 100.00%
27
29
  Active subjects: 0
@@ -40,11 +42,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
40
42
  Requires: []
41
43
  Subjects: 1
42
44
  Mutations: 2
45
+ Results: 0
43
46
  Kills: 0
44
47
  Alive: 0
45
48
  Runtime: 4.00s
46
49
  Killtime: 0.00s
47
50
  Overhead: Inf%
51
+ Mutations/s: 0.00
48
52
  Coverage: 100.00%
49
53
  Expected: 10.00%
50
54
  Active subjects: 0
@@ -66,11 +70,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
66
70
  Requires: []
67
71
  Subjects: 1
68
72
  Mutations: 2
73
+ Results: 2
69
74
  Kills: 2
70
75
  Alive: 0
71
76
  Runtime: 4.00s
72
77
  Killtime: 2.00s
73
78
  Overhead: 100.00%
79
+ Mutations/s: 0.50
74
80
  Coverage: 100.00%
75
81
  Expected: 100.00%
76
82
  Active subjects: 0
@@ -93,11 +99,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
93
99
  Requires: []
94
100
  Subjects: 1
95
101
  Mutations: 2
102
+ Results: 2
96
103
  Kills: 1
97
104
  Alive: 1
98
105
  Runtime: 4.00s
99
106
  Killtime: 2.00s
100
107
  Overhead: 100.00%
108
+ Mutations/s: 0.50
101
109
  Coverage: 50.00%
102
110
  Expected: 100.00%
103
111
  Active Jobs:
@@ -121,11 +129,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
121
129
  Requires: []
122
130
  Subjects: 1
123
131
  Mutations: 2
132
+ Results: 2
124
133
  Kills: 2
125
134
  Alive: 0
126
135
  Runtime: 4.00s
127
136
  Killtime: 2.00s
128
137
  Overhead: 100.00%
138
+ Mutations/s: 0.50
129
139
  Coverage: 100.00%
130
140
  Expected: 100.00%
131
141
  Active Jobs:
@@ -164,11 +164,13 @@ RSpec.describe Mutant::Reporter::CLI do
164
164
  Requires: []
165
165
  Subjects: 1
166
166
  Mutations: 2
167
+ Results: 2
167
168
  Kills: 2
168
169
  Alive: 0
169
170
  Runtime: 4.00s
170
171
  Killtime: 2.00s
171
172
  Overhead: 100.00%
173
+ Mutations/s: 0.50
172
174
  Coverage: 100.00%
173
175
  Expected: 100.00%
174
176
  REPORT
@@ -190,11 +192,13 @@ RSpec.describe Mutant::Reporter::CLI do
190
192
  Requires: []
191
193
  Subjects: 1
192
194
  Mutations: 2
195
+ Results: 2
193
196
  Kills: 2
194
197
  Alive: 0
195
198
  Runtime: 4.00s
196
199
  Killtime: 2.00s
197
200
  Overhead: 100.00%
201
+ Mutations/s: 0.50
198
202
  Coverage: 100.00%
199
203
  Expected: 100.00%
200
204
  Active subjects: 0
@@ -59,34 +59,6 @@ RSpec.describe Mutant::Subject::Method::Instance do
59
59
 
60
60
  it { should eql("def foo\nend") }
61
61
  end
62
-
63
- describe '#public?' do
64
- subject { object.public? }
65
-
66
- context 'when method is public' do
67
- it { should be(true) }
68
- end
69
-
70
- context 'when method is private' do
71
- before do
72
- scope.class_eval do
73
- private :foo
74
- end
75
- end
76
-
77
- it { should be(false) }
78
- end
79
-
80
- context 'when method is protected' do
81
- before do
82
- scope.class_eval do
83
- protected :foo
84
- end
85
- end
86
-
87
- it { should be(false) }
88
- end
89
- end
90
62
  end
91
63
 
92
64
  RSpec.describe Mutant::Subject::Method::Instance::Memoized do
@@ -50,32 +50,4 @@ RSpec.describe Mutant::Subject::Method::Singleton do
50
50
 
51
51
  it { should eql("def self.foo\nend") }
52
52
  end
53
-
54
- describe '#public?' do
55
- subject { object.public? }
56
-
57
- context 'when method is public' do
58
- it { should be(true) }
59
- end
60
-
61
- context 'when method is private' do
62
- before do
63
- scope.class_eval do
64
- private_class_method :foo
65
- end
66
- end
67
-
68
- it { should be(false) }
69
- end
70
-
71
- context 'when method is protected' do
72
- before do
73
- class << scope
74
- protected :foo
75
- end
76
- end
77
-
78
- it { should be(false) }
79
- end
80
- end
81
53
  end
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+ gem 'rspec', '~> 3.4.0'
3
+ gem 'rspec-core', '~> 3.4.0'
4
+ gem 'mutant', path: '../'
5
+ gem 'mutant-rspec', path: '../'
6
+ gem 'adamantium'
7
+ eval_gemfile File.expand_path('../../Gemfile.shared', __FILE__)
@@ -1,18 +1,18 @@
1
1
  require 'adamantium'
2
2
 
3
3
  original = $VERBOSE
4
- # Namespace for test application
5
- # Silence intentional violations
4
+ # Silence intentional violations made to exercise the method matcher edge cases.
5
+ # This is NOT representative for could you should write!
6
6
  $VERBOSE = false
7
+ # Namespace for test application
7
8
  module TestApp
8
9
  module InstanceMethodTests
9
- module DefinedOnce
10
- def foo; end
11
- end
12
-
13
10
  class WithMemoizer
14
11
  include Adamantium
15
- def foo; end
12
+
13
+ def bar; end; def baz; end
14
+ eval('def boz; end')
15
+ def foo; end;
16
16
  memoize :foo
17
17
  end
18
18
 
@@ -61,9 +61,9 @@ module TestApp
61
61
  def self.foo; end
62
62
  end
63
63
 
64
- module AlsoDefinedOnLvar
65
- a = Object.new
66
- def a.foo; end; def self.foo; end
64
+ module DefinedOnLvar
65
+ a = self
66
+ def a.foo; end
67
67
  end
68
68
 
69
69
  module DefinedOnConstant
@@ -90,11 +90,15 @@ module TestApp
90
90
 
91
91
  module SameLine
92
92
  module SameScope
93
- def self.foo; end; def self.foo(_arg); end;
93
+ def self.foo; end; def self.foo(_arg); end
94
94
  end
95
95
 
96
96
  module DifferentScope
97
- def self.foo; end; def DifferentScope.foo(_arg); end
97
+ def self.foo; end; def DifferentScope.foo(_arg); end; def SingletonMethodTests.foo; end
98
+ end
99
+
100
+ module DifferentName
101
+ def self.foo; end; def self.bar(_arg); end
98
102
  end
99
103
  end
100
104
  end
@@ -29,4 +29,7 @@ module TestApp
29
29
  2.4
30
30
  end
31
31
  end
32
+
33
+ class Empty
34
+ end
32
35
  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.8.7
4
+ version: 0.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -328,6 +328,7 @@ files:
328
328
  - lib/mutant/matcher/namespace.rb
329
329
  - lib/mutant/matcher/null.rb
330
330
  - lib/mutant/matcher/scope.rb
331
+ - lib/mutant/matcher/static.rb
331
332
  - lib/mutant/meta.rb
332
333
  - lib/mutant/meta/example.rb
333
334
  - lib/mutant/meta/example/dsl.rb
@@ -417,6 +418,7 @@ files:
417
418
  - lib/mutant/result.rb
418
419
  - lib/mutant/runner.rb
419
420
  - lib/mutant/runner/sink.rb
421
+ - lib/mutant/scope.rb
420
422
  - lib/mutant/selector.rb
421
423
  - lib/mutant/selector/expression.rb
422
424
  - lib/mutant/subject.rb
@@ -547,6 +549,8 @@ files:
547
549
  - spec/unit/mutant/matcher/methods/singleton_spec.rb
548
550
  - spec/unit/mutant/matcher/namespace_spec.rb
549
551
  - spec/unit/mutant/matcher/null_spec.rb
552
+ - spec/unit/mutant/matcher/scope_spec.rb
553
+ - spec/unit/mutant/matcher/static_spec.rb
550
554
  - spec/unit/mutant/mutation_spec.rb
551
555
  - spec/unit/mutant/mutator/node_spec.rb
552
556
  - spec/unit/mutant/mutator/registry_spec.rb
@@ -588,6 +592,7 @@ files:
588
592
  - test_app/.rspec
589
593
  - test_app/Gemfile.rspec3.2
590
594
  - test_app/Gemfile.rspec3.3
595
+ - test_app/Gemfile.rspec3.4
591
596
  - test_app/lib/test_app.rb
592
597
  - test_app/lib/test_app/literal.rb
593
598
  - test_app/spec/spec_helper.rb
@@ -664,6 +669,8 @@ test_files:
664
669
  - spec/unit/mutant/matcher/methods/singleton_spec.rb
665
670
  - spec/unit/mutant/matcher/namespace_spec.rb
666
671
  - spec/unit/mutant/matcher/null_spec.rb
672
+ - spec/unit/mutant/matcher/scope_spec.rb
673
+ - spec/unit/mutant/matcher/static_spec.rb
667
674
  - spec/unit/mutant/mutation_spec.rb
668
675
  - spec/unit/mutant/mutator/node_spec.rb
669
676
  - spec/unit/mutant/mutator/registry_spec.rb