General source code beautifications
This commit is contained in:
parent
7ecf828768
commit
9fcb271637
6 changed files with 16 additions and 16 deletions
|
@ -19,8 +19,8 @@ module Mutant
|
|||
|
||||
yield
|
||||
ensure
|
||||
::RSpec.instance_variable_set(:@world,original_world)
|
||||
::RSpec.instance_variable_set(:@configuration,original_configuration)
|
||||
::RSpec.instance_variable_set(:@world, original_world)
|
||||
::RSpec.instance_variable_set(:@configuration, original_configuration)
|
||||
end
|
||||
|
||||
# Return identification
|
||||
|
|
|
@ -14,7 +14,7 @@ module Mutant
|
|||
|
||||
# Positions of captured regexp groups
|
||||
# Freezing fixnums to avoid their singleton classes are patched.
|
||||
SCOPE_NAME_POSITION = 1.freeze
|
||||
SCOPE_NAME_POSITION = 1.freeze
|
||||
SCOPE_SYMBOL_POSITION = 2.freeze
|
||||
METHOD_NAME_POSITION = 3.freeze
|
||||
|
||||
|
@ -67,7 +67,7 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def scope
|
||||
scope_name.gsub(%r(\A::),'').split('::').inject(::Object) do |parent, name|
|
||||
scope_name.gsub(%r(\A::), '').split('::').inject(::Object) do |parent, name|
|
||||
parent.const_get(name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -119,7 +119,6 @@ module Mutant
|
|||
#
|
||||
def emit!(node)
|
||||
@block.call(node)
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def emit_inverted_condition
|
||||
emit_self(invert(condition),if_branch,else_branch)
|
||||
emit_self(invert(condition), if_branch, else_branch)
|
||||
end
|
||||
|
||||
# Emit deleted else branch
|
||||
|
@ -42,7 +42,7 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def emit_deleted_else_branch
|
||||
emit_self(condition,if_branch,nil)
|
||||
emit_self(condition, if_branch, nil)
|
||||
end
|
||||
|
||||
# Emit deleted if branch
|
||||
|
@ -54,7 +54,7 @@ module Mutant
|
|||
def emit_deleted_if_branch
|
||||
body = else_branch
|
||||
return unless body
|
||||
emit_self(condition,else_branch,nil)
|
||||
emit_self(condition, else_branch, nil)
|
||||
end
|
||||
|
||||
# Return ast that returns inverted boolean value
|
||||
|
@ -70,7 +70,7 @@ module Mutant
|
|||
#
|
||||
def invert(node)
|
||||
if Helper.on_18?
|
||||
return new(Rubinius::AST::Not,node)
|
||||
return new(Rubinius::AST::Not, node)
|
||||
end
|
||||
|
||||
new_send(node,:'!')
|
||||
|
@ -84,7 +84,7 @@ module Mutant
|
|||
#
|
||||
def emit_condition_mutants
|
||||
Mutator.each(condition) do |mutant|
|
||||
emit_self(mutant,if_branch,else_branch)
|
||||
emit_self(mutant, if_branch, else_branch)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -96,7 +96,7 @@ module Mutant
|
|||
#
|
||||
def emit_if_branch_mutants
|
||||
Mutator.each(if_branch) do |mutant|
|
||||
emit_self(condition,mutant,else_branch)
|
||||
emit_self(condition, mutant, else_branch)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -110,7 +110,7 @@ module Mutant
|
|||
body = else_branch
|
||||
return unless body
|
||||
Mutator.each(body) do |mutant|
|
||||
emit_self(condition,if_branch,mutant)
|
||||
emit_self(condition, if_branch, mutant)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ module Mutant
|
|||
|
||||
# Literal references to self do not need to be mutated.
|
||||
handle(Rubinius::AST::Self)
|
||||
# Some unimplemented mutations
|
||||
handle(Rubinius::AST::NilLiteral)
|
||||
handle(Rubinius::AST::Return)
|
||||
handle(Rubinius::AST::ElementAssignment)
|
||||
|
|
|
@ -47,7 +47,7 @@ module Mutant
|
|||
#
|
||||
def emit_receiver_mutations
|
||||
Mutator.each(receiver) do |mutant|
|
||||
emit_self(mutant,when_branches,else_branch)
|
||||
emit_self(mutant, when_branches, else_branch)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -58,7 +58,7 @@ module Mutant
|
|||
# @api private
|
||||
#
|
||||
def emit_else_branch_presence_mutation
|
||||
emit_self(receiver,when_branches,nil)
|
||||
emit_self(receiver, when_branches, nil)
|
||||
end
|
||||
|
||||
# Emit when branch body mutations
|
||||
|
@ -72,7 +72,7 @@ module Mutant
|
|||
Mutator.each(branch) do |mutant|
|
||||
branches = dup_when_branches
|
||||
branches[index]=mutant
|
||||
emit_self(receiver,branches,else_branch)
|
||||
emit_self(receiver, branches, else_branch)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -88,7 +88,7 @@ module Mutant
|
|||
when_branches.each_index do |index|
|
||||
dup_branches = dup_when_branches
|
||||
dup_branches.delete_at(index)
|
||||
emit_self(receiver,dup_branches,else_branch)
|
||||
emit_self(receiver, dup_branches, else_branch)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue