diff --git a/Changelog.md b/Changelog.md index 45440ac9..fdda1560 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ * Add mutation from `Hash#[]` to `Hash#key?` (#511) * Add mutation from `Hash#fetch` to `Hash#key?` (#511) * Add mutation from `#at` to `#key?` (#511) +* Add mutation from `Hash#values_at` to `Hash#fetch_values` (#510) # v0.8.8 2015-xx-xx diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index 9affd983..fb308867 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -28,6 +28,7 @@ module Mutant to_h: %i[to_hash], at: %i[fetch key?], fetch: %i[key?], + values_at: %i[fetch_values], :[] => %i[at fetch key?], :== => %i[eql? equal?], :>= => %i[> == eql? equal?], diff --git a/meta/send.rb b/meta/send.rb index ba005e0b..37a7415b 100644 --- a/meta/send.rb +++ b/meta/send.rb @@ -223,6 +223,22 @@ Mutant::Meta::Example.add do mutation 'self.gsub(a, b)' end +Mutant::Meta::Example.add do + source 'foo.values_at(a, b)' + + singleton_mutations + mutation 'foo.fetch_values(a, b)' + mutation 'foo' + mutation 'self.values_at(a, b)' + mutation 'foo.values_at(a)' + mutation 'foo.values_at(b)' + mutation 'foo.values_at(nil, b)' + mutation 'foo.values_at(self, b)' + mutation 'foo.values_at(a, nil)' + mutation 'foo.values_at(a, self)' + mutation 'foo.values_at' +end + Mutant::Meta::Example.add do source 'foo.__send__(bar)'