mutant 0.3.0.beta11 → 0.3.0.beta12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6145d1bb860965161b9e13a38d40dd6c22112c06
4
- data.tar.gz: 1d081832490c2f5f15857c6b68c2e4bb6dd3d347
3
+ metadata.gz: da90ad9db025d0f924a9a2ec2caa5f01e387f9f0
4
+ data.tar.gz: e207396b46243ec605b51217da7547c9cada8cc8
5
5
  SHA512:
6
- metadata.gz: 560ee90dd809790a3df3f2807288c290ad5401dce20ea320a988bc80d19628271b9f7633b5c8c78530e15fcfdf988806bab323cbc060e758d5c40afa50f0153c
7
- data.tar.gz: 6adcb7f2857cde6bead44261f97ec6738e259d5d4d8f61a18afa3d4618787569d0f87e2015a125522a412eb2e1d809199e6d283dd086e8b6ebf2b32ecda85326
6
+ metadata.gz: a3af704eb2e700422af4fbada84859fbbaf34562f1e5a03d97483c9f81364fb331467e800f6b096e21bb85e6fe4a1766341deee1f9d403736bf348198542e027
7
+ data.tar.gz: f72e8962725f13ee7eda39df07f2e8fb7c6efc0c22683112361cd0971c958d3fe6e41ba1f4acac3bebf465e0bff08201d2d539e536569c0c2f043e1ff20da1d5
data/TODO CHANGED
@@ -4,6 +4,7 @@ Code:
4
4
  * Log all warnings through reporter, so remove random $stderr.puts calls
5
5
 
6
6
  Mutations:
7
+ * Add true masgn mutations
7
8
  * Add binary operator specific mutations (YAY, finally reached this point)
8
9
  * Add some kind of a "do not touch me object" that raises on all messages.
9
10
  It can be used to make sure each literal value is touched.
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 16
3
- total_score: 671
3
+ total_score: 674
data/lib/mutant.rb CHANGED
@@ -64,6 +64,7 @@ require 'mutant/mutator/node/when'
64
64
  require 'mutant/mutator/node/assignment'
65
65
  require 'mutant/mutator/node/define'
66
66
  require 'mutant/mutator/node/mlhs'
67
+ require 'mutant/mutator/node/masgn'
67
68
  require 'mutant/mutator/node/return'
68
69
  require 'mutant/mutator/node/block'
69
70
  require 'mutant/mutator/node/if'
@@ -59,6 +59,7 @@ module Mutant
59
59
 
60
60
  # Matcher for memoized instance methods
61
61
  class Memoized < self
62
+ SUBJECT_CLASS = Subject::Method::Instance::Memoized
62
63
 
63
64
  private
64
65
 
@@ -12,7 +12,7 @@ module Mutant
12
12
  :next, :break, :match, :gvar, :cvar, :ensure,
13
13
  :dstr, :dsym, :yield, :rescue, :redo, :defined?,
14
14
  :lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :regopt,
15
- :ivar, :restarg, :casgn, :masgn, :resbody, :retry, :arg_expr,
15
+ :ivar, :restarg, :casgn, :resbody, :retry, :arg_expr,
16
16
  :kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
17
17
  :alias, :for, :xstr, :back_ref, :nth_ref, :class, :sclass, :match_with_lvasgn,
18
18
  :match_current_line, :or_asgn, :kwbegin
@@ -0,0 +1,27 @@
1
+ module Mutant
2
+ class Mutator
3
+ class Node
4
+
5
+ # Mutation emitter to handle multipl assignment nodes
6
+ class MultipleAssignment < self
7
+
8
+ handle(:masgn)
9
+
10
+ children :left, :right
11
+
12
+ private
13
+
14
+ # Perform dispatch
15
+ #
16
+ # @return [undefined]
17
+ #
18
+ # @api private
19
+ #
20
+ def dispatch
21
+ # noop, for now
22
+ end
23
+
24
+ end # MultipleAssignment
25
+ end # Node
26
+ end # Mutator
27
+ end # Mutant
@@ -7,6 +7,7 @@ module Mutant
7
7
  class Subject < self
8
8
 
9
9
  handle(Mutant::Subject::Method::Instance)
10
+ handle(Mutant::Subject::Method::Instance::Memoized)
10
11
  handle(Mutant::Subject::Method::Singleton)
11
12
 
12
13
  # Run subject results printer
@@ -96,6 +96,7 @@ module Mutant
96
96
  # Instance method dm2 style method lookup
97
97
  class Instance < self
98
98
  handle(Subject::Method::Instance)
99
+ handle(Subject::Method::Instance::Memoized)
99
100
 
100
101
  private
101
102
 
@@ -26,6 +26,7 @@ module Mutant
26
26
 
27
27
  # Mutator for memoized instance methods
28
28
  class Memoized < self
29
+ include NodeHelpers
29
30
 
30
31
  private
31
32
 
@@ -41,6 +42,16 @@ module Mutant
41
42
  end
42
43
  end
43
44
 
45
+ # Return neutral mutation
46
+ #
47
+ # @return [Mutation::Neutral]
48
+ #
49
+ # @api private
50
+ #
51
+ def noop_mutation
52
+ Mutation::Neutral::Noop.new(self, memoizer_node(node))
53
+ end
54
+
44
55
  # Return memoizer node for mutant
45
56
  #
46
57
  # @param [Parser::AST::Node] mutant
data/mutant.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'mutant'
5
- gem.version = '0.3.0.beta11'
5
+ gem.version = '0.3.0.beta12'
6
6
  gem.authors = [ 'Markus Schirp' ]
7
7
  gem.email = [ 'mbj@schirp-dso.com' ]
8
8
 
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mutant::Mutator, 'masgn' do
4
+
5
+ before do
6
+ Mutant::Random.stub(:hex_string => 'random')
7
+ end
8
+
9
+
10
+ let(:source) { 'a, b = c, d' }
11
+
12
+ let(:mutations) do
13
+ mutants = []
14
+ end
15
+
16
+ it_should_behave_like 'a mutator'
17
+ end
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.3.0.beta11
4
+ version: 0.3.0.beta12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
@@ -238,6 +238,7 @@ files:
238
238
  - lib/mutant/mutator/node/literal/regex.rb
239
239
  - lib/mutant/mutator/node/literal/string.rb
240
240
  - lib/mutant/mutator/node/literal/symbol.rb
241
+ - lib/mutant/mutator/node/masgn.rb
241
242
  - lib/mutant/mutator/node/mlhs.rb
242
243
  - lib/mutant/mutator/node/return.rb
243
244
  - lib/mutant/mutator/node/send.rb
@@ -331,6 +332,7 @@ files:
331
332
  - spec/unit/mutant/mutator/node/literal/regex_spec.rb
332
333
  - spec/unit/mutant/mutator/node/literal/string_spec.rb
333
334
  - spec/unit/mutant/mutator/node/literal/symbol_spec.rb
335
+ - spec/unit/mutant/mutator/node/masgn/mutation_spec.rb
334
336
  - spec/unit/mutant/mutator/node/return/mutation_spec.rb
335
337
  - spec/unit/mutant/mutator/node/send/mutation_spec.rb
336
338
  - spec/unit/mutant/mutator/node/super/mutation_spec.rb
@@ -438,6 +440,7 @@ test_files:
438
440
  - spec/unit/mutant/mutator/node/literal/regex_spec.rb
439
441
  - spec/unit/mutant/mutator/node/literal/string_spec.rb
440
442
  - spec/unit/mutant/mutator/node/literal/symbol_spec.rb
443
+ - spec/unit/mutant/mutator/node/masgn/mutation_spec.rb
441
444
  - spec/unit/mutant/mutator/node/return/mutation_spec.rb
442
445
  - spec/unit/mutant/mutator/node/send/mutation_spec.rb
443
446
  - spec/unit/mutant/mutator/node/super/mutation_spec.rb