Cleanup missing whitespace after comma

* There must be a code metric tool helping me in converting my style.
This commit is contained in:
Markus Schirp 2012-07-31 04:10:37 +02:00
parent 3963166344
commit d50ecc483d
43 changed files with 157 additions and 157 deletions

View file

@ -1,5 +1,5 @@
module Mutant
class Context
class Context
# Constant context for mutation (Class or Module)
class Constant < Context
include Veritas::Immutable
@ -24,7 +24,7 @@ module Mutant
raise ArgumentError, 'Can only build constant mutation scope from class or module'
end
new(value,*arguments)
new(value, *arguments)
end
# Return ast wrapping mutated node
@ -35,13 +35,13 @@ module Mutant
#
def root(node)
root = root_ast
root.body = @scope_class.new(1,root.name,node)
root.body = @scope_class.new(1, root.name, node)
Rubinius::AST::Script.new(root)
end
# Return unqualified name of constant
#
# @return [String]
# @return [String]
#
# @api private
#
@ -66,11 +66,11 @@ module Mutant
#
# @api private
#
def initialize(constant,keyword,scope_class)
@constant,@keyword,@scope_class = constant,keyword,scope_class
def initialize(constant, keyword, scope_class)
@constant, @keyword, @scope_class = constant, keyword, scope_class
end
# Return new root ast
# Return new root ast
#
# @return [Rubinius::AST::Node]
#
@ -82,7 +82,7 @@ module Mutant
# Return qualified name of constant
#
# @return [String]
# @return [String]
#
# @api private
#

View file

@ -2,12 +2,12 @@ module Mutant
# A method object for inserting an AST into the Rubinius VM
#
# The idea is to split the steps for a mutation into documented
# methods. Also subclasses can override the steps. Also passing
# methods. Also subclasses can override the steps. Also passing
# around the root node is not needed with a method object.
#
# As the initializer does the work there is no need for the
# As the initializer does the work there is no need for the
# instances of this class to be used outside of this class, hence
# the Loader.new method is private and the Loader.run method
# the Loader.new method is private and the Loader.run method
# returns self.
#
class Loader
@ -46,8 +46,8 @@ module Mutant
# Return compiled code for node
#
# This method actually returns a Rubnius::CompiledMethod
# instance. But it is named on the future name of CompiledMethod
# This method actually returns a Rubnius::CompiledMethod
# instance. But it is named on the future name of CompiledMethod
# that will be renamed to Rubinius::CompiledCode.
#
# @return [Rubinius::CompiledMethod]

View file

@ -25,7 +25,7 @@ module Mutant
# returns self when block given
#
# @api private
#
#
def each(&block)
return to_enum unless block_given?
mutatee.tap do |mutatee|
@ -68,7 +68,7 @@ module Mutant
# Initialize method filter
#
#
# @param [String] constant_name
# @param [Symbol] method_name
#
@ -77,11 +77,11 @@ module Mutant
# @api private
#
def initialize(constant_name, method_name)
@constant_name,@method_name = constant_name, method_name
@constant_name, @method_name = constant_name, method_name
end
# Return method
#
#
# @return [UnboundMethod]
#
# @api private
@ -96,7 +96,7 @@ module Mutant
#
abstract :node_class
# Check if node is matched
# Check if node is matched
#
# @param [Rubinius::AST::Node] node
#
@ -109,8 +109,8 @@ module Mutant
# @api private
#
def match?(node)
node.line == source_file_line &&
node.class == node_class &&
node.line == source_file_line &&
node.class == node_class &&
node.name == method_name
end
@ -160,7 +160,7 @@ module Mutant
#
# @api private
#
abstract :matched_node
abstract :matched_node
# Return mutatee
#
@ -171,7 +171,7 @@ module Mutant
def mutatee
node = matched_node
if node
Mutatee.new(context,node)
Mutatee.new(context, node)
end
end
@ -182,7 +182,7 @@ module Mutant
# @api private
#
def constant
constant_name.split('::').inject(::Object) do |parent,name|
constant_name.split('::').inject(::Object) do |parent, name|
parent.const_get(name)
end
end

View file

@ -1,5 +1,5 @@
module Mutant
class Matcher
class Matcher
class Method < Matcher
# Matcher for instance methods
class Instance < Method
@ -7,7 +7,7 @@ module Mutant
private
# Return method instance
#
#
# @return [UnboundMethod]
#
# @api private
@ -16,8 +16,8 @@ module Mutant
constant.instance_method(method_name)
end
# Return matched node class
#
# Return matched node class
#
# @return [Rubinius::AST::Define]
#
# @api private

View file

@ -7,7 +7,7 @@ module Mutant
private
# Return method instance
#
#
# @return [UnboundMethod]
#
# @api private
@ -16,8 +16,8 @@ module Mutant
constant.method(method_name)
end
# Return matched node class
#
# Return matched node class
#
# @return [Rubinius::AST::DefineSingletonScope]
#
# @api private
@ -28,7 +28,7 @@ module Mutant
# Check for stopping AST walk on branch
#
# This method exist to protect against the
# This method exist to protect against the
# artifical edge case where DefineSingleton nodes
# with differend receivers exist on the same line.
#
@ -41,13 +41,13 @@ module Mutant
# returns false when node can be followed
#
# @api private
#
#
def stop?(node)
node.is_a?(Rubinius::AST::DefineSingleton) && !match_receiver?(node)
end
# Check if receiver matches
#
#
# @param [Rubinius::AST::DefineSingleton] node
#
# @return [true]

View file

@ -31,26 +31,26 @@ module Mutant
#
def each(&block)
return to_enum unless block_given?
Mutator.each(node,&block)
Mutator.each(node, &block)
self
end
# Reset implementation to original
# Reset implementation to original
#
# This method inserts the original node again.
# This method inserts the original node again.
#
# @return [self]
#
# @api private
#
#
def reset
insert(@node)
self
end
private
private
# Initialize a mutatee
#
@ -64,18 +64,18 @@ module Mutant
#
# @api private
#
def initialize(context,node)
@context,@node = context,node
def initialize(context, node)
@context, @node = context, node
end
# Insert AST node under context
#
# @param [Rubinius::AST::Node] node
#
#
# @return [self]
#
# @api private
#
#
def insert(node)
Loader.load(context.root(node))

View file

@ -13,9 +13,9 @@ module Mutant
#
# @api private
#
def self.each(node,&block)
return to_enum(__method__,node) unless block_given?
generator(node).new(node,block)
def self.each(node, &block)
return to_enum(__method__, node) unless block_given?
generator(node).new(node, block)
self
end
@ -33,7 +33,7 @@ module Mutant
#
def self.generator(node)
unqualified_name = node.class.name.split('::').last
const_get(unqualified_name)
const_get(unqualified_name)
end
private_class_method :generator
@ -49,8 +49,8 @@ module Mutant
#
# @api private
#
def initialize(node,block)
@node,@block = node,block
def initialize(node, block)
@node, @block = node, block
dispatch
end
@ -93,7 +93,7 @@ module Mutant
# a nice interface for retring generation when generation accidentally generated the
# same AST that is about to be mutated.
#
# @yield
# @yield
# Execute block until AST node that does not equal wrapped node is generated by block
#
# @return [self]
@ -104,10 +104,10 @@ module Mutant
# @api private
#
def emit_new
MAX_TRIES.times do
MAX_TRIES.times do
node = yield
if new?(node)
emit_unsafe(node)
emit_unsafe(node)
return
end
end
@ -116,7 +116,7 @@ module Mutant
end
# Call block with node
#
#
# @param [Rubinius::AST::Node] node
#
# @return [self]
@ -163,8 +163,8 @@ module Mutant
#
# @api private
#
def emit(node_class,*arguments)
emit_safe(new(node_class,*arguments))
def emit(node_class, *arguments)
emit_safe(new(node_class, *arguments))
end
# Create a new AST node with same class as wrapped node
@ -174,7 +174,7 @@ module Mutant
# @api private
#
def new_self(*arguments)
new(node.class,*arguments)
new(node.class, *arguments)
end
# Create a new AST node with Rubnius::AST::NilLiteral class
@ -195,8 +195,8 @@ module Mutant
#
# @api private
#
def new(node_class,*arguments)
node_class.new(node.line,*arguments)
def new(node_class, *arguments)
node_class.new(node.line, *arguments)
end
# Emit a new AST node with same class as wrapped node
@ -248,7 +248,7 @@ module Mutant
# @api private
#
def emit_elements(elements)
elements.each_with_index do |element,index|
elements.each_with_index do |element, index|
dup_elements = elements.dup
Mutator.each(element).each do |mutation|
dup_elements[index]=mutation
@ -274,7 +274,7 @@ module Mutant
# @api private
#
def negative_infinity
new(Rubinius::AST::Negate,infinity)
new(Rubinius::AST::Negate, infinity)
end
# Return AST representing infinity
@ -284,7 +284,7 @@ module Mutant
# @api private
#
def infinity
new_call(new_float(1),:/,new_float(0))
new_call(new_float(1), :/, new_float(0))
end
@ -298,8 +298,8 @@ module Mutant
#
# @api private
#
def new_call(receiver,name,arguments)
new(Rubinius::AST::SendWithArguments,receiver,name,arguments)
def new_call(receiver, name, arguments)
new(Rubinius::AST::SendWithArguments, receiver, name, arguments)
end
# Return new float literal
@ -311,7 +311,7 @@ module Mutant
# @api private
#
def new_float(value)
new(Rubinius::AST::FloatLiteral,value)
new(Rubinius::AST::FloatLiteral, value)
end
# Return AST representing NaN
@ -321,7 +321,7 @@ module Mutant
# @api private
#
def nan
new_call(new_float(0),:/,new_float(0))
new_call(new_float(0), :/, new_float(0))
end
memoize :sexp

View file

@ -13,7 +13,7 @@ module Mutant
#
def dispatch
emit_nil
emit_safe(inverse(node.start,node.finish))
emit_safe(inverse(node.start, node.finish))
emit_range
end
@ -24,11 +24,11 @@ module Mutant
# @api private
#
def emit_range
start,finish = node.start,node.finish
emit_self(negative_infinity,finish)
emit_self(nan,finish)
emit_self(start,infinity)
emit_self(start,nan)
start, finish = node.start, node.finish
emit_self(negative_infinity, finish)
emit_self(nan, finish)
emit_self(start, infinity)
emit_self(start, nan)
end
# Return inverse AST node class

View file

@ -16,7 +16,7 @@ module Mutant
emit_safe(inverse)
end
# Return inverse
# Return inverse
#
# @return [Rubinius::AST::Node]
#

View file

@ -13,7 +13,7 @@ module Mutant
#
def dispatch
emit_nil
emit(Rubinius::AST::ArrayLiteral,[new_nil])
emit(Rubinius::AST::ArrayLiteral, [new_nil])
end
end
end

View file

@ -2,7 +2,7 @@ module Mutant
class Mutator
# Represent mutations of false literal
class FalseLiteral < Boolean
private
# Return inverse class

View file

@ -24,7 +24,7 @@ module Mutant
# @api private
#
def values
[0,1,-node.value]
[0, 1, -node.value]
end
end
end

View file

@ -5,7 +5,7 @@ module Mutant
private
# Emit mutants
# Emit mutants
#
# @return [undefined]
#
@ -25,7 +25,7 @@ module Mutant
# @api private
#
def values
[0.0,1.0] << -node.value
[0.0, 1.0] << -node.value
end
end
end

View file

@ -39,7 +39,7 @@ module Mutant
end
# Return values to mutate against
#
#
# @return [Array]
#
# @api private
@ -55,7 +55,7 @@ module Mutant
# @api private
#
def emit_element_presence
0.step(array.length-1,2) do |index|
0.step(array.length-1, 2) do |index|
contents = dup_array
contents.delete_at(index)
contents.delete_at(index)

View file

@ -5,14 +5,14 @@ module Mutant
private
# Return inverse
# Return inverse
#
# @return [Rubinius::AST::RangeExclude]
#
# @api private
#
def inverse(*arguments)
new(Rubinius::AST::RangeExclude,*arguments)
new(Rubinius::AST::RangeExclude, *arguments)
end
end
end

View file

@ -12,7 +12,7 @@ module Mutant
# @api private
#
def inverse(*arguments)
new(Rubinius::AST::Range,*arguments)
new(Rubinius::AST::Range, *arguments)
end
end
end

View file

@ -13,7 +13,7 @@ module Mutant
#
def dispatch
emit_nil
emit_new { new_self(Mutant.random_hex_string,node.options) }
emit_new { new_self(Mutant.random_hex_string, node.options) }
end
end
end

View file

@ -2,10 +2,10 @@ module Mutant
class Mutator
# Represent mutations of true literal
class TrueLiteral < Boolean
private
# Return inverse
# Return inverse
#
# @return [Rubinius::AST::FalseLiteral]
#

View file

@ -41,9 +41,9 @@ module Mutant
# @api private
#
def define_singleton_method(name)
class_eval(<<-RUBY,__FILE__,__LINE__+1)
class_eval(<<-RUBY, __FILE__, __LINE__+1)
def #{name}(*)
raise NotImplementedError,"\#{self.name}.\#{__method__} is not implemented"
raise NotImplementedError, "\#{self.name}.\#{__method__} is not implemented"
end
RUBY
end
@ -57,9 +57,9 @@ module Mutant
# @api private
#
def define_instance_method(name)
class_eval(<<-RUBY,__FILE__,__LINE__+1)
class_eval(<<-RUBY, __FILE__, __LINE__+1)
def #{name}(*)
raise NotImplementedError,"\#{self.class.name}#\#{__method__} is not implemented"
raise NotImplementedError, "\#{self.class.name}#\#{__method__} is not implemented"
end
RUBY
end

View file

@ -1,17 +1,17 @@
require 'spec_helper'
if "".respond_to?(:to_ast)
if "".respond_to?(:to_ast)
class CodeLoadingSubject
def x
true
end
end
describe Mutant,'code loading' do
describe Mutant, 'code loading' do
let(:context) { Mutant::Context::Constant.build(CodeLoadingSubject) }
let(:node) { 'def foo; :bar; end'.to_ast }
let(:root) { context.root(node) }
subject { Mutant::Loader.load(root) }
before { subject }

View file

@ -1,10 +1,10 @@
require 'spec_helper'
if "".respond_to?(:to_ast)
describe Mutant,'method matching' do
describe Mutant, 'method matching' do
after do
if defined?(::Foo)
Object.send(:remove_const,'Foo')
Object.send(:remove_const, 'Foo')
end
end
@ -12,7 +12,7 @@ if "".respond_to?(:to_ast)
eval(body)
File.stub(:read => body)
end
let(:defaults) { {} }
context 'on instance methods' do
@ -28,7 +28,7 @@ if "".respond_to?(:to_ast)
context 'when method is defined once' do
let(:body) do
<<-RUBY
<<-RUBY
class Foo
def bar; end
end
@ -45,7 +45,7 @@ if "".respond_to?(:to_ast)
context 'when method is defined multiple times' do
context 'on differend lines' do
let(:body) do
<<-RUBY
<<-RUBY
class Foo
def bar; end
def bar(arg); end
@ -65,7 +65,7 @@ if "".respond_to?(:to_ast)
context 'on the same line' do
let(:body) do
<<-RUBY
<<-RUBY
class Foo
def bar; end; def bar(arg); end
end
@ -84,7 +84,7 @@ if "".respond_to?(:to_ast)
context 'on the same line with differend scope' do
let(:body) do
<<-RUBY
<<-RUBY
class Foo
def self.bar; end; def bar(arg); end
end
@ -107,7 +107,7 @@ if "".respond_to?(:to_ast)
context 'in class' do
let(:body) do
<<-RUBY
class Foo
class Foo
class Bar
def baz; end
end
@ -116,7 +116,7 @@ if "".respond_to?(:to_ast)
end
let(:expectation) do
{
{
:method_line => 3,
:method_name => :baz,
:constant => Foo::Bar
@ -129,7 +129,7 @@ if "".respond_to?(:to_ast)
context 'in module' do
let(:body) do
<<-RUBY
module Foo
module Foo
class Bar
def baz; end
end
@ -138,7 +138,7 @@ if "".respond_to?(:to_ast)
end
let(:expectation) do
{
{
:method_line => 3,
:method_name => :baz,
:constant => Foo::Bar

View file

@ -30,10 +30,10 @@ shared_examples_for 'a method match' do
end
it 'should have correct constant in context' do
context.send(:constant).should eql(constant)
context.send(:constant).should eql(constant)
end
it 'should have the correct node class' do
node.should be_a(node_class)
node.should be_a(node_class)
end
end

View file

@ -8,8 +8,8 @@ unless defined?(Rubinius)
attr_accessor :body
def initialize(line,name,body=[])
@line,@name,@body = line,name,body
def initialize(line, name, body=[])
@line, @name, @body = line, name, body
end
end
@ -27,16 +27,16 @@ unless defined?(Rubinius)
# Dummy class node
class Class < Node
def initialize(line,name,superclass,body)
super(line,name)
@superclass,@body = superclass,body
def initialize(line, name, superclass, body)
super(line, name)
@superclass, @body = superclass, body
end
end
# Dummy module node
class Module < Node
def initialize(line,name,body)
super(line,name)
def initialize(line, name, body)
super(line, name)
@body = body
end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Context::Constant,'.build' do
describe Mutant::Context::Constant, '.build' do
subject { described_class.build(constant) }
let(:object) { described_class }
@ -14,7 +14,7 @@ describe Mutant::Context::Constant,'.build' do
let(:constant) { Module.new }
it 'should initialize context correctly' do
described_class.should_receive(:new).with(constant,'module',Rubinius::AST::ModuleScope).and_return(context)
described_class.should_receive(:new).with(constant, 'module', Rubinius::AST::ModuleScope).and_return(context)
should be(context)
end
@ -25,7 +25,7 @@ describe Mutant::Context::Constant,'.build' do
let(:constant) { Class.new }
it 'should initialize context correctly' do
described_class.should_receive(:new).with(constant,'class',Rubinius::AST::ClassScope).and_return(context)
described_class.should_receive(:new).with(constant, 'class', Rubinius::AST::ClassScope).and_return(context)
should be(context)
end
@ -36,7 +36,7 @@ describe Mutant::Context::Constant,'.build' do
let(:constant) { Object.new }
it 'should raise error' do
expect { subject }.to raise_error(ArgumentError,'Can only build constant mutation scope from class or module')
expect { subject }.to raise_error(ArgumentError, 'Can only build constant mutation scope from class or module')
end
end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
if "".respond_to?(:to_ast)
if "".respond_to?(:to_ast)
describe Mutant::Context::Constant, '#root' do
subject { object.root(node) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Context,'#root' do
describe Mutant::Context, '#root' do
subject { object.root(mock) }
let(:object) { described_class.allocate }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Loader,'.load' do
describe Mutant::Loader, '.load' do
subject { object.load(node) }
let(:object) { described_class }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Matcher,'#context' do
describe Mutant::Matcher, '#context' do
subject { object.context }
let(:object) { described_class.new(constant_name) }

View file

@ -3,12 +3,12 @@ require 'spec_helper'
# This spec is only present to ensure 100% test coverage.
# The code should not be triggered on runtime.
describe Mutant::Matcher,'#each' do
describe Mutant::Matcher, '#each' do
subject { object.send(:each) }
let(:object) { described_class.allocate }
it 'should raise error' do
expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher#each is not implemented')
expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher#each is not implemented')
end
end

View file

@ -38,7 +38,7 @@ describe Mutant::Matcher::Method::Classifier, '.run' do
let(:input) { 'Foo' }
it 'should raise error' do
expect { subject }.to raise_error(ArgumentError,"Cannot determine subject from #{input.inspect}")
expect { subject }.to raise_error(ArgumentError, "Cannot determine subject from #{input.inspect}")
end
end
end

View file

@ -1,12 +1,12 @@
require 'spec_helper'
# This method cannot be called directly, spec only exists for heckle demands
describe Mutant::Matcher::Method::Classifier,'#matcher' do
describe Mutant::Matcher::Method::Classifier, '#matcher' do
subject { object.matcher }
let(:object) { described_class.send(:new,match) }
let(:object) { described_class.send(:new, match) }
let(:match) { [mock,constant_name,scope_symbol,method_name] }
let(:match) { [mock, constant_name, scope_symbol, method_name] }
let(:constant_name) { mock('Constant Name') }
let(:method_name) { 'foo' }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Matcher::Method,'#context' do
describe Mutant::Matcher::Method, '#context' do
subject { object.context }
let(:object) { described_class::Singleton.new('SampleSubjects::ExampleModule','foo') }
let(:object) { described_class::Singleton.new('SampleSubjects::ExampleModule', 'foo') }
let(:context) { mock('Context') }
before do

View file

@ -2,7 +2,7 @@ require 'spec_helper'
# This method implementation cannot be called from the outside, but heckle needs to be happy.
describe Mutant::Matcher::Method,'#each' do
describe Mutant::Matcher::Method, '#each' do
let(:class_under_test) do
node = self.matched_node
Class.new(described_class) do

View file

@ -1,11 +1,11 @@
require 'spec_helper'
describe Mutant::Matcher::Method,'#method' do
describe Mutant::Matcher::Method, '#method' do
subject { object.send(:method) }
let(:object) { described_class.allocate }
it 'should raise error' do
expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher::Method#method is not implemented')
expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher::Method#method is not implemented')
end
end

View file

@ -1,12 +1,12 @@
require 'spec_helper'
describe Mutant::Matcher::Method,'#node_class' do
describe Mutant::Matcher::Method, '#node_class' do
subject { object.send(:node_class) }
let(:object) { described_class.allocate }
it 'should raise error' do
expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher::Method#node_class is not implemented')
expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher::Method#node_class is not implemented')
end
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Mutant::Mutatee,'.new' do
subject { object.new(context,ast) }
describe Mutant::Mutatee, '.new' do
subject { object.new(context, ast) }
let(:object) { described_class }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Mutatee,'#context' do
describe Mutant::Mutatee, '#context' do
subject { object.context }
let(:object) { described_class.new(context,ast) }
let(:object) { described_class.new(context, ast) }
let(:ast) { mock('AST') }
let(:context) { mock('Context') }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Mutatee,'#each' do
describe Mutant::Mutatee, '#each' do
subject { object.each { |item| yields << item } }
let(:object) { described_class.new(context,ast) }
let(:object) { described_class.new(context, ast) }
let(:root) { mock('Root AST') }
let(:ast) { mock('AST') }
let(:context) { mock('Context', :root => root) }

View file

@ -1,8 +1,8 @@
require 'spec_helper'
describe Mutant::Mutatee,'#node' do
describe Mutant::Mutatee, '#node' do
subject { object.node }
let(:object) { described_class.new(context,node) }
let(:object) { described_class.new(context, node) }
let(:node) { mock('Node') }
let(:context) { mock('Context') }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Mutatee,'#reset' do
describe Mutant::Mutatee, '#reset' do
subject { object.reset }
let(:object) { described_class.new(context,ast) }
let(:object) { described_class.new(context, ast) }
let(:root) { mock('Root AST') }
let(:ast) { mock('AST') }
let(:context) { mock('Context', :root => root) }

View file

@ -12,7 +12,7 @@ shared_examples_for 'a mutation enumerator method' do
it { should be_instance_of(to_enum.class) }
let(:expected_mutations) do
let(:expected_mutations) do
mutations.map do |mutation|
if mutation.respond_to?(:to_ast)
mutation.to_ast.to_sexp
@ -136,7 +136,7 @@ describe Mutant::Mutator, '.each' do
mutations << [:negate, [:call, [:lit, 1.0], :/, [:arglist, [:lit, 0.0]]]]
mutations << [:lit, -10.0]
end
let(:random_float) { 7.123 }
before do
@ -171,7 +171,7 @@ describe Mutant::Mutator, '.each' do
# Literal replaced with nil
mutations << [:nil]
# Mutation of each element in array
mutations << '[nil, false]'
mutations << '[false, false]'
@ -188,7 +188,7 @@ describe Mutant::Mutator, '.each' do
# Extra element
mutations << '[true, false, nil]'
end
it_should_behave_like 'a mutation enumerator method'
end
@ -226,7 +226,7 @@ describe Mutant::Mutator, '.each' do
end
context 'range literal' do
let(:source) { '1..100' }
let(:source) { '1..100' }
let(:mutations) do
mutations = []
@ -242,7 +242,7 @@ describe Mutant::Mutator, '.each' do
end
context 'exclusive range literal' do
let(:source) { '1...100' }
let(:source) { '1...100' }
let(:mutations) do
mutations = []
@ -288,7 +288,7 @@ describe Mutant::Mutator, '.each' do
let(:mutations) do
mutations = []
# Mutation of each statement in block
mutations << "nil\nfalse"
mutations << "false\nfalse"

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Mutator,'#emit_new' do
describe Mutant::Mutator, '#emit_new' do
subject { object.send(:emit_new) { node } }
class Block
@ -15,7 +15,7 @@ describe Mutant::Mutator,'#emit_new' do
end
end
let(:object) { class_under_test.new(wrapped_node,block) }
let(:object) { class_under_test.new(wrapped_node, block) }
let(:block) { Block.new }
let(:wrapped_node) { '"foo"'.to_ast }
@ -40,12 +40,12 @@ describe Mutant::Mutator,'#emit_new' do
block.arguments.should eql([node])
end
end
context 'when new AST could not be generated' do
let(:node) { '"foo"'.to_ast }
it 'should raise error' do
expect { subject }.to raise_error(RuntimeError,'New AST could not be generated after 3 attempts')
expect { subject }.to raise_error(RuntimeError, 'New AST could not be generated after 3 attempts')
end
end
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Mutant::Mutator,'#emit_safe' do
subject { object.send(:emit_safe,node) }
describe Mutant::Mutator, '#emit_safe' do
subject { object.send(:emit_safe, node) }
class Block
attr_reader :arguments
@ -15,7 +15,7 @@ describe Mutant::Mutator,'#emit_safe' do
end
end
let(:object) { class_under_test.new(wrapped_node,block) }
let(:object) { class_under_test.new(wrapped_node, block) }
let(:block) { Block.new }
let(:wrapped_node) { '"foo"'.to_ast }
@ -40,7 +40,7 @@ describe Mutant::Mutator,'#emit_safe' do
block.arguments.should eql([node])
end
end
context 'with node that is equal to wrapped node' do
let(:node) { '"foo"'.to_ast }