Do not mutate calls to block given

This commit is contained in:
Markus Schirp 2012-08-21 14:19:44 +02:00
parent 2cec22b76b
commit 96ce758d41
2 changed files with 17 additions and 1 deletions

View file

@ -67,11 +67,13 @@ module Mutant
# @api private
#
def emit_implicit_self_receiver
# FIXME: Edge case that is currently not very well undestood
return if name == :block_given?
return unless self?
mutant = dup_node
mutant.privately = true
# TODO: Fix rubinius to allow this as an attr_accessor
mutant.instance_variable_set(:@vcall_style,true)
mutant.instance_variable_set(:@vcall_style, true)
emit(mutant)
end

View file

@ -2,6 +2,20 @@ require 'spec_helper'
describe Mutant::Mutator, 'call' do
context 'send without arguments' do
# This could not be reproduced in a test case but happens in the mutant source code?
context 'block given' do
context 'implicit self' do
let(:source) { 'block_given?' }
it_should_behave_like 'a noop mutator'
end
context 'explicit self' do
let(:source) { 'self.block_given?' }
it_should_behave_like 'a noop mutator'
end
end
context 'with self as receiver' do
context 'implicit' do