Add mutation from #[] to #at #fetch

This commit is contained in:
Markus Schirp 2015-07-05 16:02:46 +00:00
parent 6b8c4da512
commit 838a03845a
3 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,7 @@
# v0.8.1 2015-xx-xx
* Add mutation from #[] to #at / #fetch
# v0.8.0 2015-06-15
* Drop support for ruby < 2.1

View file

@ -24,6 +24,8 @@ module Mutant
to_s: %i[to_str],
to_i: %i[to_int],
to_a: %i[to_ary],
at: %i[fetch],
:[] => %i[at fetch],
:== => %i[eql? equal?],
:>= => %i[> == eql? equal?],
:<= => %i[< == eql? equal?],

View file

@ -367,6 +367,8 @@ Mutant::Meta::Example.add do
mutation '1'
mutation 'foo'
mutation 'foo[]'
mutation 'foo.at(1)'
mutation 'foo.fetch(1)'
mutation 'self[1]'
mutation 'foo[0]'
mutation 'foo[2]'
@ -380,6 +382,8 @@ Mutant::Meta::Example.add do
singleton_mutations
mutation 'self.foo'
mutation 'self.foo.at()'
mutation 'self.foo.fetch()'
mutation 'self[]'
mutation 'foo[]'
end
@ -391,6 +395,8 @@ Mutant::Meta::Example.add do
mutation 'self[self]'
mutation 'self[nil]'
mutation 'self[]'
mutation 'self.at(foo)'
mutation 'self.fetch(foo)'
mutation 'foo'
end
@ -400,6 +406,8 @@ Mutant::Meta::Example.add do
singleton_mutations
mutation 'foo'
mutation 'foo[]'
mutation 'foo.at(*bar)'
mutation 'foo.fetch(*bar)'
mutation 'foo[nil]'
mutation 'foo[self]'
mutation 'foo[bar]'