Handle masgn outside of generic mutator
May result in syntactially invalid AST. Currently is a noop.
This commit is contained in:
		
							parent
							
								
									023df844f9
								
							
						
					
					
						commit
						7505344a8b
					
				
					 7 changed files with 49 additions and 3 deletions
				
			
		
							
								
								
									
										1
									
								
								TODO
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -4,6 +4,7 @@ Code:
 | 
			
		|||
  * Log all warnings through reporter, so remove random $stderr.puts calls
 | 
			
		||||
 | 
			
		||||
Mutations:
 | 
			
		||||
  * Add true masgn mutations
 | 
			
		||||
  * Add binary operator specific mutations (YAY, finally reached this point)
 | 
			
		||||
  * Add some kind of a "do not touch me object" that raises on all messages.
 | 
			
		||||
    It can be used to make sure each literal value is touched.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,3 @@
 | 
			
		|||
---
 | 
			
		||||
threshold: 16
 | 
			
		||||
total_score: 671
 | 
			
		||||
total_score: 674
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,6 +64,7 @@ require 'mutant/mutator/node/when'
 | 
			
		|||
require 'mutant/mutator/node/assignment'
 | 
			
		||||
require 'mutant/mutator/node/define'
 | 
			
		||||
require 'mutant/mutator/node/mlhs'
 | 
			
		||||
require 'mutant/mutator/node/masgn'
 | 
			
		||||
require 'mutant/mutator/node/return'
 | 
			
		||||
require 'mutant/mutator/node/block'
 | 
			
		||||
require 'mutant/mutator/node/if'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ module Mutant
 | 
			
		|||
          :next, :break, :match, :gvar, :cvar, :ensure,
 | 
			
		||||
          :dstr, :dsym, :yield, :rescue, :redo, :defined?,
 | 
			
		||||
          :lvar, :splat, :const, :blockarg, :block_pass, :op_asgn, :regopt,
 | 
			
		||||
          :ivar, :restarg, :casgn, :masgn, :resbody, :retry, :arg_expr,
 | 
			
		||||
          :ivar, :restarg, :casgn, :resbody, :retry, :arg_expr,
 | 
			
		||||
          :kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
 | 
			
		||||
          :alias, :for, :xstr, :back_ref, :nth_ref, :class, :sclass, :match_with_lvasgn,
 | 
			
		||||
          :match_current_line, :or_asgn, :kwbegin
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										27
									
								
								lib/mutant/mutator/node/masgn.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								lib/mutant/mutator/node/masgn.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Mutant
 | 
			
		||||
  class Mutator
 | 
			
		||||
    class Node
 | 
			
		||||
 | 
			
		||||
      # Mutation emitter to handle multipl assignment nodes
 | 
			
		||||
      class MultipleAssignment < self
 | 
			
		||||
 | 
			
		||||
        handle(:masgn)
 | 
			
		||||
 | 
			
		||||
        children :left, :right
 | 
			
		||||
 | 
			
		||||
      private
 | 
			
		||||
 | 
			
		||||
        # Perform dispatch
 | 
			
		||||
        #
 | 
			
		||||
        # @return [undefined]
 | 
			
		||||
        #
 | 
			
		||||
        # @api private
 | 
			
		||||
        #
 | 
			
		||||
        def dispatch
 | 
			
		||||
          # noop, for now
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
      end # MultipleAssignment
 | 
			
		||||
    end # Node
 | 
			
		||||
  end # Mutator
 | 
			
		||||
end # Mutant
 | 
			
		||||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
 | 
			
		||||
Gem::Specification.new do |gem|
 | 
			
		||||
  gem.name        = 'mutant'
 | 
			
		||||
  gem.version     = '0.3.0.beta11'
 | 
			
		||||
  gem.version     = '0.3.0.beta12'
 | 
			
		||||
  gem.authors     = [ 'Markus Schirp' ]
 | 
			
		||||
  gem.email       = [ 'mbj@schirp-dso.com' ]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								spec/unit/mutant/mutator/node/masgn/mutation_spec.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								spec/unit/mutant/mutator/node/masgn/mutation_spec.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
require 'spec_helper'
 | 
			
		||||
 | 
			
		||||
describe Mutant::Mutator, 'masgn' do
 | 
			
		||||
 | 
			
		||||
  before do
 | 
			
		||||
    Mutant::Random.stub(:hex_string => 'random')
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  let(:source) { 'a, b = c, d' }
 | 
			
		||||
 | 
			
		||||
  let(:mutations) do
 | 
			
		||||
    mutants = []
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it_should_behave_like 'a mutator'
 | 
			
		||||
end
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue