diff --git a/lib/mutant/mutator/node/literal/array.rb b/lib/mutant/mutator/node/literal/array.rb index b18f71e4..18dcb391 100644 --- a/lib/mutant/mutator/node/literal/array.rb +++ b/lib/mutant/mutator/node/literal/array.rb @@ -9,6 +9,8 @@ module Mutant handle(:array) + children :first + private # Emit mutations @@ -19,7 +21,7 @@ module Mutant emit_type mutate_body return unless children.one? - emit(children.first) + emit(first) unless n_splat?(first) end # Mutate body diff --git a/meta/lvasgn.rb b/meta/lvasgn.rb index 1ba9e190..fb3e325c 100644 --- a/meta/lvasgn.rb +++ b/meta/lvasgn.rb @@ -8,3 +8,18 @@ Mutant::Meta::Example.add :lvasgn do mutation 'a = false' mutation 'a = nil' end + +Mutant::Meta::Example.add :array, :lvasgn do + source 'a = *b' + + singleton_mutations + mutation 'a__mutant__ = *b' + mutation 'a = nil' + mutation 'a = self' + mutation 'a = []' + mutation 'a = [nil]' + mutation 'a = [self]' + mutation 'a = [*self]' + mutation 'a = [*nil]' + mutation 'a = [b]' +end