Remove nil => Object.new mutation
Mutation operators should *always* mutate to a less powerfull structure / less complex semantics. To force tests to prove complex semantics are needed. The mutation removed with that commit violates that principle.
This commit is contained in:
parent
563075403f
commit
a98319650b
4 changed files with 2 additions and 12 deletions
|
@ -18,7 +18,6 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def dispatch
|
||||
emit(NEW_OBJECT)
|
||||
end
|
||||
|
||||
end # Nil
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Mutant::Mutator::Node::Literal, 'nil' do
|
||||
let(:source) { 'nil' }
|
||||
let(:mutations) { ['::Object.new'] }
|
||||
let(:source) { 'nil' }
|
||||
let(:mutations) { [] }
|
||||
|
||||
it_should_behave_like 'a mutator'
|
||||
end
|
||||
|
|
|
@ -15,7 +15,6 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|||
mutants << '$a = nil; nil'
|
||||
mutants << '$a = nil'
|
||||
mutants << '$a'
|
||||
mutants << '$a = ::Object.new; $a'
|
||||
mutants << '$srandom = nil; $a'
|
||||
mutants << 'nil; $a'
|
||||
end
|
||||
|
@ -31,7 +30,6 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|||
mutants << '@@a = nil; nil'
|
||||
mutants << '@@a = nil'
|
||||
mutants << '@@a'
|
||||
mutants << '@@a = ::Object.new; @@a'
|
||||
mutants << '@@srandom = nil; @@a'
|
||||
mutants << 'nil; @@a'
|
||||
end
|
||||
|
@ -45,7 +43,6 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|||
mutants << '@a = nil; nil'
|
||||
mutants << '@a = nil'
|
||||
mutants << '@a'
|
||||
mutants << '@a = ::Object.new; @a'
|
||||
mutants << '@srandom = nil; @a'
|
||||
mutants << 'nil; @a'
|
||||
end
|
||||
|
@ -60,7 +57,6 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|||
mutants = []
|
||||
mutants << 'a = nil; nil'
|
||||
mutants << 'a = nil'
|
||||
mutants << 'a = ::Object.new; a'
|
||||
# TODO: fix invalid AST
|
||||
# These ASTs are not valid and should NOT be emitted
|
||||
# Mutations of lvarasgn need to be special cased to avoid this.
|
||||
|
|
|
@ -237,7 +237,6 @@ describe Mutant::Mutator, 'send' do
|
|||
mutations = []
|
||||
mutations << 'foo'
|
||||
mutations << 'nil'
|
||||
mutations << 'foo(::Object.new)'
|
||||
end
|
||||
|
||||
it_should_behave_like 'a mutator'
|
||||
|
@ -252,7 +251,6 @@ describe Mutant::Mutator, 'send' do
|
|||
mutations << 'self.foo'
|
||||
mutations << 'foo(nil)'
|
||||
mutations << 'nil'
|
||||
mutations << 'self.foo(::Object.new)'
|
||||
mutations << 'nil.foo(nil)'
|
||||
end
|
||||
|
||||
|
@ -268,7 +266,6 @@ describe Mutant::Mutator, 'send' do
|
|||
mutations = []
|
||||
mutations << "foo.#{keyword}"
|
||||
mutations << 'foo'
|
||||
mutations << "foo.#{keyword}(::Object.new)"
|
||||
mutations << "nil.#{keyword}(nil)"
|
||||
mutations << 'nil'
|
||||
end
|
||||
|
@ -285,8 +282,6 @@ describe Mutant::Mutator, 'send' do
|
|||
mutations = []
|
||||
mutations << 'foo()'
|
||||
mutations << 'foo(nil)'
|
||||
mutations << 'foo(::Object.new, nil)'
|
||||
mutations << 'foo(nil, ::Object.new)'
|
||||
mutations << 'nil'
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue