Add mutation from csend to send

This commit is contained in:
Markus Schirp 2016-01-24 03:49:49 +00:00
parent 47dcad29ea
commit 8f6d9384c1
6 changed files with 38 additions and 2 deletions

View file

@ -1,3 +1,7 @@
# v0.8.11 2016-01-xx
* Add support for mutating csend (duck tape operator) into regular sends
# v0.8.10 2016-01-24
* Add support for parser 2.3 (via unparser 0.2.5)

View file

@ -1,3 +1,3 @@
---
threshold: 18
total_score: 1167
total_score: 1170

View file

@ -113,6 +113,7 @@ require 'mutant/mutator/node/zsuper'
require 'mutant/mutator/node/restarg'
require 'mutant/mutator/node/send'
require 'mutant/mutator/node/send/binary'
require 'mutant/mutator/node/send/conditional'
require 'mutant/mutator/node/send/attribute_assignment'
require 'mutant/mutator/node/send/index'
require 'mutant/mutator/node/when'

View file

@ -8,7 +8,7 @@ module Mutant
# These nodes still need a dedicated mutator,
# your contribution is that close!
handle(
:csend, :ensure, :redo, :regopt, :retry, :arg_expr,
:ensure, :redo, :regopt, :retry, :arg_expr,
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :empty,
:alias, :for, :xstr, :back_ref, :class,
:sclass, :match_with_lvasgn, :while_post,

View file

@ -0,0 +1,23 @@
module Mutant
class Mutator
class Node
class Send
class Conditional < self
handle(:csend)
private
# Perform dispatch
#
# @return [undefined]
def dispatch
super()
emit(s(:send, *children))
end
end # Conditional
end # Send
end # Node
end # Mutator
end # Mutant

8
meta/csend.rb Normal file
View file

@ -0,0 +1,8 @@
Mutant::Meta::Example.add do
source 'a&.b'
singleton_mutations
mutation 'a.b'
mutation 'self&.b'
mutation 'a'
end