Skip to content

Commit

Permalink
Add a === b -> a.is_a?(b) mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
dgollahon committed Jan 2, 2021
1 parent 44c23ea commit 94322f9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/mutant/mutator/node/send.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Send < self
:< => %i[== eql? equal?],
:<= => %i[< == eql? equal?],
:== => %i[eql? equal?],
:=== => %i[is_a?],
:> => %i[== eql? equal?],
:>= => %i[> == eql? equal?],
__send__: %i[public_send],
Expand Down
16 changes: 15 additions & 1 deletion meta/send.rb
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@
mutation 'foo(n..-2)'
end

(Mutant::AST::Types::BINARY_METHOD_OPERATORS - %i[=~ <= >= < > == != eql?]).each do |operator|
(Mutant::AST::Types::BINARY_METHOD_OPERATORS - %i[=~ <= >= < > == === != eql?]).each do |operator|
Mutant::Meta::Example.add :send do
source "true #{operator} false"

Expand Down Expand Up @@ -727,3 +727,17 @@
mutation 'foo'
mutation 'foo(a__mutant__: nil)'
end

Mutant::Meta::Example.add :send do
source 'a === b'

singleton_mutations

mutation 'a'
mutation 'b'
mutation 'nil === b'
mutation 'self === b'
mutation 'a === nil'
mutation 'a === self'
mutation 'a.is_a?(b)'
end

0 comments on commit 94322f9

Please sign in to comment.