Add mutation Hash#fetch -> Hash#key?

Fixes #457
This commit is contained in:
John Backus 2015-12-25 15:43:13 -05:00
parent dd747ed3d5
commit 3e8543de65
3 changed files with 11 additions and 0 deletions

View file

@ -1,6 +1,7 @@
# Master (unreleased)
* Add mutation from `Hash#[]` to `Hash#key?` (#511)
* Add mutation from `Hash#fetch` to `Hash#key?` (#511)
# v0.8.8 2015-xx-xx

View file

@ -27,6 +27,7 @@ module Mutant
to_a: %i[to_ary],
to_h: %i[to_hash],
at: %i[fetch],
fetch: %i[key?],
:[] => %i[at fetch key?],
:== => %i[eql? equal?],
:>= => %i[> == eql? equal?],

View file

@ -359,6 +359,15 @@ Mutant::Meta::Example.add do
mutation 'foo(nil)'
end
Mutant::Meta::Example.add do
source 'self.fetch(nil)'
singleton_mutations
mutation 'self.fetch'
mutation 'fetch(nil)'
mutation 'self.key?(nil)'
end
Unparser::Constants::KEYWORDS.each do |keyword|
Mutant::Meta::Example.add do
source "foo.#{keyword}(nil)"