parent
9d0355075d
commit
5a5e21c80e
4 changed files with 33 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
* Add mutation from `a != b` to `!a.eql?(b)` and `!a.equal?(b)` #417
|
* Add mutation from `a != b` to `!a.eql?(b)` and `!a.equal?(b)` #417
|
||||||
* Add mutation `A.const_get(:B)` -> `A::B` #426
|
* Add mutation `A.const_get(:B)` -> `A::B` #426
|
||||||
* Add mutation `def foo(*args); end` into `def foo(*args); args = []; end` #423
|
* Add mutation `def foo(*args); end` into `def foo(*args); args = []; end` #423
|
||||||
|
* Add mutation from `foo.baz { bar }` to `foo.bar` #416
|
||||||
|
|
||||||
# v0.8.3 2015-09-01
|
# v0.8.3 2015-09-01
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
threshold: 18
|
threshold: 18
|
||||||
total_score: 1219
|
total_score: 1223
|
||||||
|
|
|
@ -36,6 +36,22 @@ module Mutant
|
||||||
return unless body
|
return unless body
|
||||||
emit(body)
|
emit(body)
|
||||||
emit_body_mutations
|
emit_body_mutations
|
||||||
|
|
||||||
|
mutate_body_receiver
|
||||||
|
end
|
||||||
|
|
||||||
|
# Mutate method send in body scope of `send`
|
||||||
|
#
|
||||||
|
# @return [undefined]
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
|
def mutate_body_receiver
|
||||||
|
return unless n_send?(body)
|
||||||
|
|
||||||
|
body_meta = AST::Meta::Send.new(body)
|
||||||
|
send_meta = AST::Meta::Send.new(send)
|
||||||
|
|
||||||
|
emit(s(:send, send_meta.receiver, body_meta.selector, *body_meta.arguments))
|
||||||
end
|
end
|
||||||
|
|
||||||
end # Block
|
end # Block
|
||||||
|
|
|
@ -69,3 +69,18 @@ Mutant::Meta::Example.add do
|
||||||
mutation 'foo { |(_a)| }'
|
mutation 'foo { |(_a)| }'
|
||||||
mutation 'foo'
|
mutation 'foo'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Mutant::Meta::Example.add do
|
||||||
|
source 'self.foo { bar(nil) }'
|
||||||
|
|
||||||
|
singleton_mutations
|
||||||
|
mutation 'self.foo'
|
||||||
|
mutation 'foo { bar(nil) }'
|
||||||
|
mutation 'self.foo { bar }'
|
||||||
|
mutation 'self.foo { nil }'
|
||||||
|
mutation 'self.foo {}'
|
||||||
|
mutation 'self.foo { self }'
|
||||||
|
mutation 'self.foo { raise }'
|
||||||
|
mutation 'bar(nil)'
|
||||||
|
mutation 'self.bar(nil)'
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue