1
0
Fork 0

Add relational operator mutations

[fix ]
This commit is contained in:
Markus Schirp 2014-08-11 15:21:03 +00:00
parent 8c4e7cc665
commit cf1c9a2bed
3 changed files with 73 additions and 3 deletions
Changelog.md
lib/mutant/mutator/node
meta

View file

@ -4,7 +4,11 @@
* Add -j, --jobs flag to control concurrency.
* Fix blind spots on send with block.
* Add mutation from `foo { bar }` to `bar`
* Add mutation from `reverse_merge` to `merge`
* Add mutation from `#reverse_merge` to `#merge`
* Add mutation from `#<=` to `#<`, `#==`, `#eql?`, `#equal?`
* Add mutation from `#>=` to `#>`, `#==`, `#eql?`, `#equal?`
* Add mutation from `#>` to `#==`, `#eql?`, `#equal?`
* Add mutation from `#<` to `#==`, `#eql?`, `#equal?`
* Fix reporting of diff errors to include context [tjchambers]
# v0.5.26 2014-07-07

View file

@ -23,7 +23,11 @@ module Mutant
to_s: [:to_str],
to_i: [:to_int],
to_a: [:to_ary],
:== => [:eql?, :equal?]
:== => [:eql?, :equal?],
:>= => [:>, :==, :eql?, :equal?],
:<= => [:<, :==, :eql?, :equal?],
:> => [:==, :eql?, :equal?],
:< => [:==, :eql?, :equal?],
)
private

View file

@ -1,5 +1,67 @@
# encoding: utf-8
Mutant::Meta::Example.add do
source 'a > b'
singleton_mutations
mutation 'a == b'
mutation 'a.eql?(b)'
mutation 'a.equal?(b)'
mutation 'nil > b'
mutation 'self > b'
mutation 'a > nil'
mutation 'a > self'
mutation 'a'
mutation 'b'
end
Mutant::Meta::Example.add do
source 'a >= b'
singleton_mutations
mutation 'a > b'
mutation 'a == b'
mutation 'a.eql?(b)'
mutation 'a.equal?(b)'
mutation 'nil >= b'
mutation 'self >= b'
mutation 'a >= nil'
mutation 'a >= self'
mutation 'a'
mutation 'b'
end
Mutant::Meta::Example.add do
source 'a <= b'
singleton_mutations
mutation 'a < b'
mutation 'a == b'
mutation 'a.eql?(b)'
mutation 'a.equal?(b)'
mutation 'nil <= b'
mutation 'self <= b'
mutation 'a <= nil'
mutation 'a <= self'
mutation 'a'
mutation 'b'
end
Mutant::Meta::Example.add do
source 'a < b'
singleton_mutations
mutation 'a == b'
mutation 'a.eql?(b)'
mutation 'a.equal?(b)'
mutation 'nil < b'
mutation 'self < b'
mutation 'a < nil'
mutation 'a < self'
mutation 'a'
mutation 'b'
end
Mutant::Meta::Example.add do
source 'reverse_each'
@ -319,7 +381,7 @@ Mutant::Meta::Example.add do
mutation 'self[*bar]'
end
(Mutant::AST::Types::BINARY_METHOD_OPERATORS - [:==, :eql?]).each do |operator|
(Mutant::AST::Types::BINARY_METHOD_OPERATORS - [:<=, :>=, :<, :>, :==, :eql?]).each do |operator|
Mutant::Meta::Example.add do
source "true #{operator} false"