Add unary operator expansions
This commit is contained in:
parent
bc408d52d2
commit
88e1f0941c
3 changed files with 58 additions and 26 deletions
|
@ -57,29 +57,33 @@ module Mutant
|
||||||
end
|
end
|
||||||
|
|
||||||
MAPPING = {
|
MAPPING = {
|
||||||
:'!~' => :nomatch_operator,
|
:<=> => :spaceship_operator,
|
||||||
:'!=' => :inequality_operator,
|
:=== => :case_equality_operator,
|
||||||
:<=> => :spaceship_operator,
|
:[]= => :element_writer,
|
||||||
:=== => :case_equality_operator,
|
:[] => :element_reader,
|
||||||
:[]= => :element_writer,
|
:<= => :less_than_or_equal_to_operator,
|
||||||
:[] => :element_reader,
|
:>= => :greater_than_or_equal_to_operator,
|
||||||
:== => :equality_operator,
|
:~@ => :unary_match_operator,
|
||||||
:<= => :less_than_or_equal_to_operator,
|
:+@ => :unary_addition_operator,
|
||||||
:>= => :greater_than_or_equal_to_operator,
|
:-@ => :unary_substraction_operator,
|
||||||
:=~ => :match_operator,
|
:== => :equality_operator,
|
||||||
:<< => :left_shift_operator,
|
:!~ => :nomatch_operator,
|
||||||
:>> => :right_shift_operator,
|
:!= => :inequality_operator,
|
||||||
:** => :exponentation_operator,
|
:=~ => :match_operator,
|
||||||
:* => :multiplication_operator,
|
:<< => :left_shift_operator,
|
||||||
:% => :modulo_operator,
|
:>> => :right_shift_operator,
|
||||||
:/ => :division_operator,
|
:** => :exponentation_operator,
|
||||||
:| => :bitwise_or_operator,
|
:* => :multiplication_operator,
|
||||||
:^ => :bitwise_xor_operator,
|
:% => :modulo_operator,
|
||||||
:& => :bitwise_and_operator,
|
:/ => :division_operator,
|
||||||
:< => :less_than_operator,
|
:| => :bitwise_or_operator,
|
||||||
:> => :greater_than_operator,
|
:! => :negation_operator,
|
||||||
:+ => :addition_operator,
|
:^ => :bitwise_xor_operator,
|
||||||
:- => :substraction_operator
|
:& => :bitwise_and_operator,
|
||||||
|
:< => :less_than_operator,
|
||||||
|
:> => :greater_than_operator,
|
||||||
|
:+ => :addition_operator,
|
||||||
|
:- => :substraction_operator
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPANSIONS = {
|
EXPANSIONS = {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Gem::Specification.new do |gem|
|
Gem::Specification.new do |gem|
|
||||||
gem.name = 'mutant'
|
gem.name = 'mutant'
|
||||||
gem.version = '0.2.1'
|
gem.version = '0.2.2'
|
||||||
gem.authors = [ 'Markus Schirp' ]
|
gem.authors = [ 'Markus Schirp' ]
|
||||||
gem.email = [ 'mbj@seonic.net' ]
|
gem.email = [ 'mbj@seonic.net' ]
|
||||||
gem.description = 'Mutation testing for ruby under rubinius'
|
gem.description = 'Mutation testing for ruby under rubinius'
|
||||||
|
|
|
@ -16,6 +16,34 @@ describe Mutant::Strategy::Rspec::ExampleLookup, '#spec_file' do
|
||||||
it { should be_frozen }
|
it { should be_frozen }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'negation operator' do
|
||||||
|
let(:method_name) { :! }
|
||||||
|
let(:expected_spec_file) { 'negation_operator_spec.rb' }
|
||||||
|
|
||||||
|
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with unary match method' do
|
||||||
|
let(:method_name) { :~@ }
|
||||||
|
let(:expected_spec_file) { 'unary_match_operator_spec.rb' }
|
||||||
|
|
||||||
|
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with unary substraction method' do
|
||||||
|
let(:method_name) { :-@ }
|
||||||
|
let(:expected_spec_file) { 'unary_substraction_operator_spec.rb' }
|
||||||
|
|
||||||
|
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with unary addition method' do
|
||||||
|
let(:method_name) { :+@ }
|
||||||
|
let(:expected_spec_file) { 'unary_addition_operator_spec.rb' }
|
||||||
|
|
||||||
|
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
||||||
|
end
|
||||||
|
|
||||||
context 'with bitwise xor method' do
|
context 'with bitwise xor method' do
|
||||||
let(:method_name) { :^ }
|
let(:method_name) { :^ }
|
||||||
let(:expected_spec_file) { 'bitwise_xor_operator_spec.rb' }
|
let(:expected_spec_file) { 'bitwise_xor_operator_spec.rb' }
|
||||||
|
@ -136,7 +164,7 @@ describe Mutant::Strategy::Rspec::ExampleLookup, '#spec_file' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with nomatch operator method' do
|
context 'with nomatch operator method' do
|
||||||
let(:method_name) { :'!~' }
|
let(:method_name) { :!~ }
|
||||||
let(:expected_spec_file) { 'nomatch_operator_spec.rb' }
|
let(:expected_spec_file) { 'nomatch_operator_spec.rb' }
|
||||||
|
|
||||||
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
||||||
|
@ -150,7 +178,7 @@ describe Mutant::Strategy::Rspec::ExampleLookup, '#spec_file' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with inequality operator method' do
|
context 'with inequality operator method' do
|
||||||
let(:method_name) { :'!=' }
|
let(:method_name) { :!= }
|
||||||
let(:expected_spec_file) { 'inequality_operator_spec.rb' }
|
let(:expected_spec_file) { 'inequality_operator_spec.rb' }
|
||||||
|
|
||||||
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
it_should_behave_like 'Mutant::Strategy::Rspec::ExampleLookup#spec_file'
|
||||||
|
|
Loading…
Add table
Reference in a new issue