commit
c24d9285b9
7 changed files with 10 additions and 16 deletions
|
@ -16,9 +16,7 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def dispatch
|
||||
Util::Array.each(children, self) do |children|
|
||||
emit_child_subset(children)
|
||||
end
|
||||
Util::Array.each(children, self, &method(:emit_child_subset))
|
||||
children.each_with_index do |child, index|
|
||||
mutate_child(index)
|
||||
emit(child) unless children.eql?([child])
|
||||
|
|
|
@ -30,8 +30,8 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def mutate_condition
|
||||
emit_condition_mutations do |condition|
|
||||
!n_self?(condition)
|
||||
emit_condition_mutations do |node|
|
||||
!n_self?(node)
|
||||
end
|
||||
emit_type(n_not(condition), if_branch, else_branch) unless n_match_current_line?(condition)
|
||||
emit_type(N_TRUE, if_branch, else_branch)
|
||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe Mutant::Matcher::Filter do
|
|||
subject { object.each { |entry| yields << entry } }
|
||||
|
||||
let(:matcher) { [subject_a, subject_b] }
|
||||
let(:predicate) { ->(subject) { subject.eql?(subject_a) } }
|
||||
let(:predicate) { ->(node) { node.eql?(subject_a) } }
|
||||
|
||||
let(:subject_a) { double('Subject A') }
|
||||
let(:subject_b) { double('Subject B') }
|
||||
|
|
|
@ -5,7 +5,7 @@ RSpec.describe Mutant::Matcher::Method::Instance do
|
|||
let(:reporter) { Fixtures::TEST_CONFIG.reporter }
|
||||
|
||||
describe '#each' do
|
||||
subject { object.each { |subject| yields << subject } }
|
||||
subject { object.each(&yields.method(:<<)) }
|
||||
|
||||
let(:object) { described_class.build(env, scope, method) }
|
||||
let(:method) { scope.instance_method(method_name) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# rubocop:disable ClassAndModuleChildren
|
||||
RSpec.describe Mutant::Matcher::Method::Singleton, '#each' do
|
||||
subject { object.each { |subject| yields << subject } }
|
||||
subject { object.each(&yields.method(:<<)) }
|
||||
|
||||
let(:object) { described_class.new(env, scope, method) }
|
||||
let(:method) { scope.method(method_name) }
|
||||
|
|
|
@ -5,11 +5,9 @@ RSpec.describe Mutant::RequireHighjack do
|
|||
let(:require_calls) { [] }
|
||||
|
||||
let(:target) do
|
||||
require_calls = self.require_calls
|
||||
acc = require_calls
|
||||
Module.new do
|
||||
define_method(:require) do |logical_name|
|
||||
require_calls << logical_name
|
||||
end
|
||||
define_method(:require, &acc.method(:<<))
|
||||
module_function :require
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,11 +8,9 @@ RSpec.describe Mutant::WarningFilter do
|
|||
let(:object) { described_class.new(target) }
|
||||
|
||||
let(:target) do
|
||||
writes = self.writes
|
||||
acc = writes
|
||||
Module.new do
|
||||
define_singleton_method :write do |message|
|
||||
writes << message
|
||||
end
|
||||
define_singleton_method(:write, &acc.method(:<<))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue