Fix mutations on case without conditional
This commit is contained in:
parent
0758c16ba3
commit
9bafb2c395
3 changed files with 39 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
Changes:
|
||||
|
||||
* Fix crash without conditionals
|
||||
* Remove dependency to descendants tracker
|
||||
* Add mutation #== => #eql?, #equal?
|
||||
* Add mutation #eql? => #equal?
|
||||
|
|
|
@ -20,7 +20,7 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def dispatch
|
||||
emit_condition_mutations
|
||||
emit_condition_mutations if condition
|
||||
emit_when_mutations
|
||||
emit_else_mutations
|
||||
emit_nil
|
||||
|
|
|
@ -9,6 +9,43 @@ describe Mutant::Mutator::Node::Case do
|
|||
Mutant::Random.stub(hex_string: random_string)
|
||||
end
|
||||
|
||||
context 'without condition' do
|
||||
let(:source) do
|
||||
<<-RUBY
|
||||
case
|
||||
when true
|
||||
else
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
let(:mutations) do
|
||||
mutations = []
|
||||
mutations << 'nil'
|
||||
mutations << <<-RUBY
|
||||
case
|
||||
when true
|
||||
raise
|
||||
else
|
||||
end
|
||||
RUBY
|
||||
mutations << <<-RUBY
|
||||
case
|
||||
when false
|
||||
else
|
||||
end
|
||||
RUBY
|
||||
mutations << <<-RUBY
|
||||
case
|
||||
when nil
|
||||
else
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
|
||||
it_should_behave_like 'a mutator'
|
||||
end
|
||||
|
||||
context 'with multiple when branches' do
|
||||
let(:source) do
|
||||
<<-RUBY
|
||||
|
|
Loading…
Add table
Reference in a new issue