Fix invalid AST generation on operator method with self as receiver

This commit is contained in:
Markus Schirp 2014-06-15 19:48:27 +00:00
parent 3a84968c95
commit 3d94003616
3 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,7 @@
# v0.5.22 2014-06-15
* Fix invalid AST generation on operator method mutation with self as receiver.
# v0.5.21 2014-06-15
* Readd mutation of index assignments

View file

@ -170,8 +170,9 @@ module Mutant
#
def emit_implicit_self
emit_receiver(nil) if n_self?(receiver) && !(
KEYWORDS.include?(selector) ||
OP_ASSIGN.include?(parent_type) ||
KEYWORDS.include?(selector) ||
METHOD_OPERATORS.include?(selector) ||
OP_ASSIGN.include?(parent_type) ||
attribute_assignment?
)
end

View file

@ -235,6 +235,16 @@ Mutant::Meta::Example.add do
mutation 'foo[]'
end
Mutant::Meta::Example.add do
source 'self[foo]'
singleton_mutations
mutation 'self[self]'
mutation 'self[nil]'
mutation 'self[]'
mutation 'foo'
end
Mutant::Meta::Example.add do
source 'foo[*bar]'