Move case statements spec to correct location

This commit is contained in:
Markus Schirp 2012-08-01 18:04:31 +02:00
parent 13b8227c03
commit 38cb5bb4d8
2 changed files with 27 additions and 26 deletions

View file

@ -5,32 +5,6 @@
require 'spec_helper' require 'spec_helper'
describe Mutant::Mutator, '.each' do describe Mutant::Mutator, '.each' do
context 'case statements' do
let(:source) { 'case self.condition; when true; true; when false; false; else raise; end' }
let(:mutations) do
mutations = []
# Delete each when once
mutations << 'case self.condition; when true; true; else raise; end'
mutations << 'case self.condition; when false; false; else raise; end'
# Mutate receiver
mutations << 'case condition; when true; true; when false; false; else raise; end'
# Remove else branch
mutations << 'case self.condition; when true; true; when false; false; end'
# Mutate when branch bodies
mutations << 'case self.condition; when true; nil; when false; false; else raise; end'
mutations << 'case self.condition; when true; false; when false; false; else raise; end'
mutations << 'case self.condition; when true; true; when false; nil; else raise; end'
mutations << 'case self.condition; when true; true; when false; true; else raise; end'
end
it_should_behave_like 'a mutator'
end
pending 'interpolated string literal (DynamicString)' do pending 'interpolated string literal (DynamicString)' do
let(:source) { '"foo#{1}bar"' } let(:source) { '"foo#{1}bar"' }

View file

@ -0,0 +1,27 @@
require 'spec_helper'
describe Mutant::Mutator::ReceiverCase do
let(:source) { 'case self.condition; when true; true; when false; false; else raise; end' }
let(:mutations) do
mutations = []
# Delete each when once
mutations << 'case self.condition; when true; true; else raise; end'
mutations << 'case self.condition; when false; false; else raise; end'
# Mutate receiver
mutations << 'case condition; when true; true; when false; false; else raise; end'
# Remove else branch
mutations << 'case self.condition; when true; true; when false; false; end'
# Mutate when branch bodies
mutations << 'case self.condition; when true; nil; when false; false; else raise; end'
mutations << 'case self.condition; when true; false; when false; false; else raise; end'
mutations << 'case self.condition; when true; true; when false; nil; else raise; end'
mutations << 'case self.condition; when true; true; when false; true; else raise; end'
end
it_should_behave_like 'a mutator'
end