Fix invalid block mutations on lambda

[Fix #802]
This commit is contained in:
Markus Schirp 2018-12-24 00:50:19 +00:00
parent ef088809d8
commit 4fba42a5db
2 changed files with 15 additions and 1 deletions

View file

@ -51,7 +51,7 @@ module Mutant
#
# @return [undefined]
def mutate_body_receiver
return unless n_send?(body)
return if n_lambda?(send) || !n_send?(body)
body_meta = AST::Meta::Send.new(body)

View file

@ -7,3 +7,17 @@ Mutant::Meta::Example.add :block, :lambda do
mutation '->() { raise }'
end
Mutant::Meta::Example.add :block, :lambda do
source '->() { foo.bar }'
singleton_mutations
mutation '->() { }'
mutation '->() { self }'
mutation '->() { nil }'
mutation '->() { raise }'
mutation '->() { self.bar }'
mutation '->() { foo }'
mutation 'foo.bar'
end