Add mutation from =~ and match to match?

Fixes #571
This commit is contained in:
John Backus 2017-01-07 22:17:00 -08:00
parent eb985f94b2
commit 05b94c3264
No known key found for this signature in database
GPG key ID: 9A91898D0B0B2FBE
2 changed files with 5 additions and 1 deletions

View file

@ -36,6 +36,8 @@ module Mutant
at: %i[fetch key?],
fetch: %i[key?],
values_at: %i[fetch_values],
match: %i[match?],
'=~': %i[match?],
:[] => %i[at fetch key?],
:== => %i[eql? equal?],
:>= => %i[> == eql? equal?],

View file

@ -625,7 +625,7 @@ Mutant::Meta::Example.add :send do
mutation 'self[*bar]'
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"
@ -756,6 +756,7 @@ Mutant::Meta::Example.add :send do
mutation 'self =~ //'
mutation '//'
mutation 'a =~ /nomatch\A/'
mutation 'a.match?(//)'
end
Mutant::Meta::Example.add :send do
@ -766,6 +767,7 @@ Mutant::Meta::Example.add :send do
mutation '//.match'
mutation '//.match(nil)'
mutation '//.match(self)'
mutation '//.match?(a)'
mutation '//'
mutation '/nomatch\A/.match(a)'
end