Add unary call mutation

This commit is contained in:
Markus Schirp 2012-12-29 16:10:45 +01:00
parent a8aeb0f2f6
commit 22a5cda3f0
3 changed files with 17 additions and 2 deletions

View file

@ -1,6 +1,7 @@
# v0.2.8 2012-12-29
* [feature] Mutate method call receivers "foo.bar" => "foo"
* [feature] Mutate unary calls ```coerce(object)``` => ```object```
* [feature] Mutate method call receivers ```foo.bar``` => ```foo```
[Compare v0.2.7..v0.2.8](https://github.com/mbj/mutant/compare/v0.2.7...v0.2.8)
@ -22,7 +23,7 @@
* [feature] Run noop mutation per subject to guard against initial failing specs
* [feature] Mutate default into required arguments
* [feature] Mutate default literals
* [feature] Mutate unwinding of pattern args |(a, b), c] => |a, b, c|
* [feature] Mutate unwinding of pattern args ```|(a, b), c|``` => ```|a, b, c|```
* [feature] Mutate define and block arguments
* [feature] Mutate block arguments, inklusive pattern args
* [feature] Recurse into block bodies

View file

@ -152,9 +152,22 @@ module Mutant
#
def dispatch
super
emit_call_remove_mutation
emit_attribute_mutations(:arguments)
end
# Emit transfomr call mutation
#
# @return [undefined]
#
# @api private
#
def emit_call_remove_mutation
array = node.arguments.array
return unless array.length == 1
emit(array.first)
end
end
end
end

View file

@ -42,6 +42,7 @@ describe Mutant::Mutator, 'send' do
let(:mutations) do
mutations = []
mutations << 'foo()'
mutations << 'nil'
mutations << 'foo(Object.new)'
end