From 475512146f928006a366cadbb3d3fb28f4dd2573 Mon Sep 17 00:00:00 2001 From: Dan Kubb Date: Sat, 7 Sep 2013 23:10:25 -0700 Subject: [PATCH] Change emit_nil to not emit on the left node of an assignment * Add emit_nil to other nodes so that they can be replaced with nil, effectively removing them from the code. --- lib/mutant/mutator/node.rb | 13 ++++++- lib/mutant/mutator/node/block.rb | 1 + lib/mutant/mutator/node/case.rb | 1 + lib/mutant/mutator/node/dstr.rb | 13 +++++++ lib/mutant/mutator/node/if.rb | 1 + lib/mutant/mutator/node/masgn.rb | 2 +- .../node/named_value/variable_assignment.rb | 1 + lib/mutant/mutator/node/return.rb | 3 +- lib/mutant/mutator/node/send.rb | 1 + lib/mutant/mutator/node/super.rb | 1 + lib/mutant/mutator/node/while.rb | 1 + .../mutator/node/block/mutation_spec.rb | 5 +++ .../mutator/node/block_pass/mutation_spec.rb | 1 + .../mutant/mutator/node/case/mutation_spec.rb | 4 ++ .../node/defined_predicate/mutation_spec.rb | 8 +++- .../mutant/mutator/node/dstr/mutation_spec.rb | 2 + .../mutant/mutator/node/dsym/mutation_spec.rb | 1 + .../mutant/mutator/node/if/mutation_spec.rb | 5 +++ .../mutant/mutator/node/literal/regex_spec.rb | 6 ++- .../mutator/node/masgn/mutation_spec.rb | 8 +++- .../node/match_current_line/mutation_spec.rb | 1 + .../node/named_value/access/mutation_spec.rb | 4 ++ .../variable_assignment/mutation_spec.rb | 7 ++-- .../mutator/node/restarg/mutation_spec.rb | 2 + .../mutator/node/return/mutation_spec.rb | 10 +++-- .../mutant/mutator/node/send/mutation_spec.rb | 38 ++++++++++++++++++- .../mutator/node/super/mutation_spec.rb | 4 ++ .../mutator/node/while/mutation_spec.rb | 3 ++ 28 files changed, 129 insertions(+), 18 deletions(-) diff --git a/lib/mutant/mutator/node.rb b/lib/mutant/mutator/node.rb index 39748541..cb64967b 100644 --- a/lib/mutant/mutator/node.rb +++ b/lib/mutant/mutator/node.rb @@ -181,7 +181,7 @@ module Mutant # @api private # def emit_nil - emit(N_NIL) + emit(N_NIL) unless agsn_left? end # Return new self typed child @@ -222,6 +222,17 @@ module Mutant parent && parent.node.type end + # Test if the node is the left of an or_asgn or op_asgn + # + # @return [Boolean] + # + # @api private + # + def agsn_left? + [:or_asgn, :op_asgn, :and_asgn].include?(parent_type) && + parent.left.equal?(node) + end + end # Node end # Mutator end # Mutant diff --git a/lib/mutant/mutator/node/block.rb b/lib/mutant/mutator/node/block.rb index fecac4ba..4c17ce69 100644 --- a/lib/mutant/mutator/node/block.rb +++ b/lib/mutant/mutator/node/block.rb @@ -26,6 +26,7 @@ module Mutant end emit_body(nil) emit_body(RAISE) + emit_nil end end # Block diff --git a/lib/mutant/mutator/node/case.rb b/lib/mutant/mutator/node/case.rb index 4c42f29a..873ffb68 100644 --- a/lib/mutant/mutator/node/case.rb +++ b/lib/mutant/mutator/node/case.rb @@ -23,6 +23,7 @@ module Mutant emit_condition_mutations emit_when_mutations emit_else_mutations + emit_nil end # Emit when mutations diff --git a/lib/mutant/mutator/node/dstr.rb b/lib/mutant/mutator/node/dstr.rb index 33ba45b4..443da339 100644 --- a/lib/mutant/mutator/node/dstr.rb +++ b/lib/mutant/mutator/node/dstr.rb @@ -9,6 +9,19 @@ module Mutant handle(:dstr) + private + + # Emit mutations + # + # @return [undefined] + # + # @api private + # + def dispatch + super + emit_nil + end + end # Dstr end # Node end # Mutator diff --git a/lib/mutant/mutator/node/if.rb b/lib/mutant/mutator/node/if.rb index 8f1cc25b..31454190 100644 --- a/lib/mutant/mutator/node/if.rb +++ b/lib/mutant/mutator/node/if.rb @@ -22,6 +22,7 @@ module Mutant mutate_condition mutate_if_branch mutate_else_branch + emit_nil end # Emit conditon mutations diff --git a/lib/mutant/mutator/node/masgn.rb b/lib/mutant/mutator/node/masgn.rb index 496ee67c..2ef04c34 100644 --- a/lib/mutant/mutator/node/masgn.rb +++ b/lib/mutant/mutator/node/masgn.rb @@ -20,7 +20,7 @@ module Mutant # @api private # def dispatch - # noop, for now + emit_nil end end # MultipleAssignment diff --git a/lib/mutant/mutator/node/named_value/variable_assignment.rb b/lib/mutant/mutator/node/named_value/variable_assignment.rb index b9e03586..171bac11 100644 --- a/lib/mutant/mutator/node/named_value/variable_assignment.rb +++ b/lib/mutant/mutator/node/named_value/variable_assignment.rb @@ -30,6 +30,7 @@ module Mutant def dispatch mutate_name emit_value_mutations if value # mlhs! + emit_nil end # Emit name mutations diff --git a/lib/mutant/mutator/node/return.rb b/lib/mutant/mutator/node/return.rb index d38bc26d..33cb2b8c 100644 --- a/lib/mutant/mutator/node/return.rb +++ b/lib/mutant/mutator/node/return.rb @@ -22,9 +22,8 @@ module Mutant if value emit(value) emit_value_mutations - else - emit_nil end + emit_nil end end # Return diff --git a/lib/mutant/mutator/node/send.rb b/lib/mutant/mutator/node/send.rb index d054798a..95bad8f4 100644 --- a/lib/mutant/mutator/node/send.rb +++ b/lib/mutant/mutator/node/send.rb @@ -71,6 +71,7 @@ module Mutant else non_index_dispatch end + emit_nil end # Perform non index dispatch diff --git a/lib/mutant/mutator/node/super.rb b/lib/mutant/mutator/node/super.rb index 530482dd..d3b01367 100644 --- a/lib/mutant/mutator/node/super.rb +++ b/lib/mutant/mutator/node/super.rb @@ -27,6 +27,7 @@ module Mutant mutate_child(index) delete_child(index) end + emit_nil end end # Super diff --git a/lib/mutant/mutator/node/while.rb b/lib/mutant/mutator/node/while.rb index 853973ca..76d24886 100644 --- a/lib/mutant/mutator/node/while.rb +++ b/lib/mutant/mutator/node/while.rb @@ -23,6 +23,7 @@ module Mutant emit_condition_mutations emit_body_mutations emit_body(nil) + emit_nil end end # While diff --git a/spec/unit/mutant/mutator/node/block/mutation_spec.rb b/spec/unit/mutant/mutator/node/block/mutation_spec.rb index 0ac4de38..2c48dd9e 100644 --- a/spec/unit/mutant/mutator/node/block/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/block/mutation_spec.rb @@ -12,7 +12,10 @@ describe Mutant::Mutator, 'block' do mutations << 'foo { b }' mutations << 'foo {}' mutations << 'foo { raise }' + mutations << 'foo { a; nil }' + mutations << 'foo { nil; b }' mutations << 'foo' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -35,6 +38,7 @@ describe Mutant::Mutator, 'block' do mutations << 'foo { |a| }' mutations << 'foo { |b| }' mutations << 'foo { || }' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -61,6 +65,7 @@ describe Mutant::Mutator, 'block' do mutations << 'foo { |(a, srandom), c| }' mutations << 'foo { |(a, b), srandom| }' mutations << 'foo' + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/block_pass/mutation_spec.rb b/spec/unit/mutant/mutator/node/block_pass/mutation_spec.rb index 702f8a5d..096b3c0d 100644 --- a/spec/unit/mutant/mutator/node/block_pass/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/block_pass/mutation_spec.rb @@ -8,6 +8,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'block_pass' do let(:mutations) do mutants = [] mutants << 'foo' + mutants << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/case/mutation_spec.rb b/spec/unit/mutant/mutator/node/case/mutation_spec.rb index 6ec98923..6a96c3bf 100644 --- a/spec/unit/mutant/mutator/node/case/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/case/mutation_spec.rb @@ -217,6 +217,8 @@ describe Mutant::Mutator::Node::Case do :else end RUBY + + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -314,6 +316,8 @@ describe Mutant::Mutator::Node::Case do :else end RUBY + + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/defined_predicate/mutation_spec.rb b/spec/unit/mutant/mutator/node/defined_predicate/mutation_spec.rb index 6ce3c8ed..a45a2db4 100644 --- a/spec/unit/mutant/mutator/node/defined_predicate/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/defined_predicate/mutation_spec.rb @@ -3,8 +3,12 @@ require 'spec_helper' describe Mutant::Mutator::Node::Generic, 'defined?' do - let(:source) { 'defined?(foo)' } - let(:mutations) { [] } + let(:source) { 'defined?(foo)' } + + let(:mutations) do + mutations = [] + mutations << 'defined?(nil)' + end it_should_behave_like 'a mutator' end diff --git a/spec/unit/mutant/mutator/node/dstr/mutation_spec.rb b/spec/unit/mutant/mutator/node/dstr/mutation_spec.rb index 5e7a7c8d..f1d29016 100644 --- a/spec/unit/mutant/mutator/node/dstr/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/dstr/mutation_spec.rb @@ -15,6 +15,8 @@ describe Mutant::Mutator::Node::Dstr, 'dstr' do mutations << '"#{nil}#{bar}baz"' mutations << '"foo#{bar}random"' mutations << '"foo#{bar}#{nil}"' + mutations << '"foo#{nil}baz"' + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/dsym/mutation_spec.rb b/spec/unit/mutant/mutator/node/dsym/mutation_spec.rb index eed07c37..1fe8f35a 100644 --- a/spec/unit/mutant/mutator/node/dsym/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/dsym/mutation_spec.rb @@ -15,6 +15,7 @@ describe Mutant::Mutator::Node::Generic, 'dsum' do mutations << ':"#{nil}#{bar}baz"' mutations << ':"foo#{bar}random"' mutations << ':"foo#{bar}#{nil}"' + mutations << ':"foo#{nil}baz"' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/if/mutation_spec.rb b/spec/unit/mutant/mutator/node/if/mutation_spec.rb index 5f0c076e..34585732 100644 --- a/spec/unit/mutant/mutator/node/if/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/if/mutation_spec.rb @@ -36,6 +36,8 @@ describe Mutant::Mutator, 'if' do # mutations of else body mutants << 'if :condition; true; else true; end' mutants << 'if :condition; true; else nil; end' + + mutants << 'nil' end it_should_behave_like 'a mutator' @@ -51,6 +53,8 @@ describe Mutant::Mutator, 'if' do mutants << 'if condition; nil; end' mutants << 'if true; true; end' mutants << 'if false; true; end' + mutants << 'if nil; true; end' + mutants << 'nil' end it_should_behave_like 'a mutator' @@ -69,6 +73,7 @@ describe Mutant::Mutator, 'if' do mutants << 'unless true; true; end' mutants << 'unless false; true; end' mutants << 'if :condition; true; end' + mutants << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/literal/regex_spec.rb b/spec/unit/mutant/mutator/node/literal/regex_spec.rb index 8a3a1dce..6f054bdc 100644 --- a/spec/unit/mutant/mutator/node/literal/regex_spec.rb +++ b/spec/unit/mutant/mutator/node/literal/regex_spec.rb @@ -9,9 +9,9 @@ describe Mutant::Mutator::Node::Literal, 'regex' do let(:mutations) do mutations = [] - mutations << 'nil' mutations << '//' # match all mutations << '/a\A/' # match nothing + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -22,10 +22,12 @@ describe Mutant::Mutator::Node::Literal, 'regex' do let(:mutations) do mutations = [] - mutations << 'nil' mutations << '//' # match all mutations << '/#{foo}n/' # match all mutations << '/a\A/' # match nothing + mutations << '/#{nil.bar}n/' + mutations << '/#{nil}n/' + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb b/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb index f1c94d63..33fc4117 100644 --- a/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb @@ -3,8 +3,12 @@ require 'spec_helper' describe Mutant::Mutator, 'masgn' do - let(:source) { 'a, b = c, d' } - let(:mutations) { [] } + let(:source) { 'a, b = c, d' } + + let(:mutations) do + mutations = [] + mutations << 'nil' + end it_should_behave_like 'a mutator' end diff --git a/spec/unit/mutant/mutator/node/match_current_line/mutation_spec.rb b/spec/unit/mutant/mutator/node/match_current_line/mutation_spec.rb index 50e20117..21d9743b 100644 --- a/spec/unit/mutant/mutator/node/match_current_line/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/match_current_line/mutation_spec.rb @@ -14,6 +14,7 @@ describe Mutant::Mutator::Node::Generic, 'match_current_line' do mutations << 'true if nil' mutations << 'true if !//' mutations << 'true if /a\A/' + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb b/spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb index 15d04bfb..18c9cc77 100644 --- a/spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb @@ -17,6 +17,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do mutants << '$a' mutants << '$a = ::Object.new; $a' mutants << '$srandom = nil; $a' + mutants << 'nil; $a' end it_should_behave_like 'a mutator' @@ -32,6 +33,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do mutants << '@@a' mutants << '@@a = ::Object.new; @@a' mutants << '@@srandom = nil; @@a' + mutants << 'nil; @@a' end end @@ -45,6 +47,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do mutants << '@a' mutants << '@a = ::Object.new; @a' mutants << '@srandom = nil; @a' + mutants << 'nil; @a' end it_should_behave_like 'a mutator' @@ -60,6 +63,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do mutants << 'a' mutants << 'a = ::Object.new; a' mutants << 'srandom = nil; a' + mutants << 'nil; a' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb b/spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb index d04207a5..ebeed93b 100644 --- a/spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb @@ -15,6 +15,7 @@ describe Mutant::Mutator::Node::NamedValue::VariableAssignment, 'mutations' do mutations << '$srandom = true' mutations << '$a = false' mutations << '$a = nil' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -25,10 +26,10 @@ describe Mutant::Mutator::Node::NamedValue::VariableAssignment, 'mutations' do let(:mutations) do mutations = [] - mutations << '@@srandom = true' mutations << '@@a = false' mutations << '@@a = nil' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -39,10 +40,10 @@ describe Mutant::Mutator::Node::NamedValue::VariableAssignment, 'mutations' do let(:mutations) do mutations = [] - mutations << '@srandom = true' mutations << '@a = false' mutations << '@a = nil' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -53,10 +54,10 @@ describe Mutant::Mutator::Node::NamedValue::VariableAssignment, 'mutations' do let(:mutations) do mutations = [] - mutations << 'srandom = true' mutations << 'a = false' mutations << 'a = nil' + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/restarg/mutation_spec.rb b/spec/unit/mutant/mutator/node/restarg/mutation_spec.rb index 8d325937..9f96a1c6 100644 --- a/spec/unit/mutant/mutator/node/restarg/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/restarg/mutation_spec.rb @@ -10,6 +10,8 @@ describe Mutant::Mutator::Node::Generic, 'restarg' do mutants << 'foo' mutants << 'foo(nil)' mutants << 'foo(bar)' + mutants << 'foo(*nil)' + mutants << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/return/mutation_spec.rb b/spec/unit/mutant/mutator/node/return/mutation_spec.rb index e099041c..dfe68e2d 100644 --- a/spec/unit/mutant/mutator/node/return/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/return/mutation_spec.rb @@ -7,18 +7,22 @@ describe Mutant::Mutator, 'return' do context 'return without value' do let(:source) { 'return' } - let(:mutations) { ['nil'] } + let(:mutations) do + mutations = [] + mutations << 'nil' + end it_should_behave_like 'a mutator' end context 'return with value' do - let(:source) { 'return nil' } + let(:source) { 'return foo' } let(:mutations) do mutations = [] + mutations << 'foo' + mutations << 'return nil' mutations << 'nil' - mutations << 'return ::Object.new' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/send/mutation_spec.rb b/spec/unit/mutant/mutator/node/send/mutation_spec.rb index 7eaff09b..e9817b40 100644 --- a/spec/unit/mutant/mutator/node/send/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/send/mutation_spec.rb @@ -15,6 +15,10 @@ describe Mutant::Mutator, 'send' do mutations << 'foo.gsub(b)' mutations << 'foo.gsub' mutations << 'foo.sub(a, b)' + mutations << 'foo.gsub(a, nil)' + mutations << 'foo.gsub(nil, b)' + mutations << 'nil.gsub(a, b)' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -29,6 +33,9 @@ describe Mutant::Mutator, 'send' do mutations << 'foo.public_send(bar)' mutations << 'bar' mutations << 'foo' + mutations << 'foo.send(nil)' + mutations << 'nil.send(bar)' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -40,6 +47,7 @@ describe Mutant::Mutator, 'send' do let(:mutations) do mutations = [] mutations << 'foo ||= expression' + mutations << 'self.foo ||= nil' mutations << 'nil.foo ||= expression' mutations << 'nil' end @@ -53,6 +61,7 @@ describe Mutant::Mutator, 'send' do let(:mutations) do mutations = [] mutations << 'foo' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -66,6 +75,8 @@ describe Mutant::Mutator, 'send' do mutations << 'foo' mutations << 'foo(nil)' mutations << 'foo(bar)' + mutations << 'foo(*nil)' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -77,6 +88,7 @@ describe Mutant::Mutator, 'send' do let(:mutations) do mutations = [] mutations << 'foo' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -88,6 +100,7 @@ describe Mutant::Mutator, 'send' do let(:mutations) do mutations = [] mutations << 'foo' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -97,7 +110,12 @@ describe Mutant::Mutator, 'send' do context 'implicit' do let(:source) { 'foo' } - it_should_behave_like 'a noop mutator' + let(:mutations) do + mutations = [] + mutations << 'nil' + end + + it_should_behave_like 'a mutator' end context 'explict receiver' do @@ -108,6 +126,7 @@ describe Mutant::Mutator, 'send' do mutations << 'foo' mutations << 'self' mutations << 'nil.foo' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -133,6 +152,8 @@ describe Mutant::Mutator, 'send' do let(:mutations) do mutations = [] mutations << 'foo' + mutations << 'nil.bar' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -146,6 +167,8 @@ describe Mutant::Mutator, 'send' do mutations << 'self.class' mutations << 'self.foo' mutations << 'nil.class.foo' + mutations << 'nil.foo' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -192,8 +215,9 @@ describe Mutant::Mutator, 'send' do mutations = [] mutations << "foo.#{keyword}" mutations << 'foo' - mutations << 'nil' mutations << "foo.#{keyword}(::Object.new)" + mutations << "nil.#{keyword}(nil)" + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -210,6 +234,7 @@ describe Mutant::Mutator, 'send' do mutations << 'foo(nil)' mutations << 'foo(::Object.new, nil)' mutations << 'foo(nil, ::Object.new)' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -225,6 +250,11 @@ describe Mutant::Mutator, 'send' do mutations << '(left - right)' mutations << 'left / foo' mutations << 'right / foo' + mutations << '(left - right) / nil' + mutations << '(left - nil) / foo' + mutations << '(nil - right) / foo' + mutations << 'nil / foo' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -242,6 +272,7 @@ describe Mutant::Mutator, 'send' do mutations << "true #{operator} nil" mutations << 'true' mutations << 'false' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -253,6 +284,9 @@ describe Mutant::Mutator, 'send' do mutations = [] mutations << 'left' mutations << 'right' + mutations << "left #{operator} nil" + mutations << "nil #{operator} right" + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/super/mutation_spec.rb b/spec/unit/mutant/mutator/node/super/mutation_spec.rb index 47304065..f4152d64 100644 --- a/spec/unit/mutant/mutator/node/super/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/super/mutation_spec.rb @@ -21,6 +21,7 @@ describe Mutant::Mutator, 'super' do let(:mutations) do mutations = [] mutations << 'super' + mutations << 'nil' end it_should_behave_like 'a mutator' @@ -35,6 +36,9 @@ describe Mutant::Mutator, 'super' do mutations << 'super()' mutations << 'super(foo)' mutations << 'super(bar)' + mutations << 'super(foo, nil)' + mutations << 'super(nil, bar)' + mutations << 'nil' end it_should_behave_like 'a mutator' diff --git a/spec/unit/mutant/mutator/node/while/mutation_spec.rb b/spec/unit/mutant/mutator/node/while/mutation_spec.rb index 1b220ad7..3a8bb319 100644 --- a/spec/unit/mutant/mutator/node/while/mutation_spec.rb +++ b/spec/unit/mutant/mutator/node/while/mutation_spec.rb @@ -14,6 +14,9 @@ describe Mutant::Mutator::Node::While do mutations << 'while true; end' mutations << 'while false; foo; bar; end' mutations << 'while nil; foo; bar; end' + mutations << 'while true; foo; nil; end' + mutations << 'while true; nil; bar; end' + mutations << 'nil' end it_should_behave_like 'a mutator'