Merge pull request #812 from mbj/fix/invalid-lambda-mutations

Fix invalid block mutations on lambda
This commit is contained in:
Markus Schirp 2018-12-24 00:52:15 +00:00 committed by GitHub
commit d702379d5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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