Use scope based subclassing pattern

This commit is contained in:
Markus Schirp 2012-08-09 23:07:22 +02:00
parent b087d4b38f
commit 9755009966
23 changed files with 36 additions and 36 deletions

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Context class Context
# Constant context for mutation (Class or Module) # Constant context for mutation (Class or Module)
class Constant < Context class Constant < self
include Immutable include Immutable
private_class_method :new private_class_method :new

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Matcher class Matcher
# Matcher to find AST for method # Matcher to find AST for method
class Method < Matcher class Method < self
include Immutable include Immutable
# Parse a method string into filter # Parse a method string into filter

View file

@ -1,6 +1,6 @@
module Mutant module Mutant
class Matcher class Matcher
class Method < Matcher class Method < self
# A classifier for input strings # A classifier for input strings
class Classifier class Classifier
extend Immutable extend Immutable

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Matcher class Matcher
class Method < Matcher class Method < self
# Matcher for instance methods # Matcher for instance methods
class Instance < Method class Instance < self
private private

View file

@ -2,7 +2,7 @@ module Mutant
class Matcher class Matcher
class Method class Method
# Matcher for singleton methods # Matcher for singleton methods
class Singleton < Method class Singleton < self
private private

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Mutator class Mutator
# Mutator on AST blocks # Mutator on AST blocks
class Block < Mutator class Block < self
handle Rubinius::AST::Block handle Rubinius::AST::Block

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Mutator class Mutator
# Abstract class for mutatiosn where messages are send # Abstract class for mutatiosn where messages are send
class Call < Mutator class Call < self
handle(Rubinius::AST::Send) handle(Rubinius::AST::Send)

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Mutator class Mutator
# Mutator for Rubinius::AST::If nodes # Mutator for Rubinius::AST::If nodes
class IfStatement < Mutator class IfStatement < self
handle(Rubinius::AST::If) handle(Rubinius::AST::If)

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Mutator class Mutator
# Abstract mutator for literal AST nodes # Abstract mutator for literal AST nodes
class Literal < Mutator class Literal < self
private private

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Mutator class Mutator
class Literal < Mutator class Literal < self
# Mutator for array literals # Mutator for array literals
class Array < Literal class Array < self
handle(Rubinius::AST::ArrayLiteral) handle(Rubinius::AST::ArrayLiteral)

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Mutator class Mutator
class Literal < Mutator class Literal < self
# Abstract mutator for boolean literals # Abstract mutator for boolean literals
class Boolean < Literal class Boolean < self
private private
@ -28,7 +28,7 @@ module Mutant
end end
# Represent mutations of true literal # Represent mutations of true literal
class TrueLiteral < Boolean class TrueLiteral < self
INVERSE_CLASS = Rubinius::AST::FalseLiteral INVERSE_CLASS = Rubinius::AST::FalseLiteral
handle(Rubinius::AST::TrueLiteral) handle(Rubinius::AST::TrueLiteral)
@ -36,7 +36,7 @@ module Mutant
# Represent mutations of false literal # Represent mutations of false literal
class FalseLiteral < Boolean class FalseLiteral < self
INVERSE_CLASS = Rubinius::AST::TrueLiteral INVERSE_CLASS = Rubinius::AST::TrueLiteral
handle(Rubinius::AST::FalseLiteral) handle(Rubinius::AST::FalseLiteral)

View file

@ -2,7 +2,7 @@ module Mutant
class Mutator class Mutator
class Literal class Literal
# Abstract mutations on dynamic literals # Abstract mutations on dynamic literals
class Dynamic < Literal class Dynamic < self
private private

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Mutator class Mutator
class Literal < Mutator class Literal < self
# Mutator for empty array literals # Mutator for empty array literals
class EmptyArray < Literal class EmptyArray < self
handle(Rubinius::AST::EmptyArray) handle(Rubinius::AST::EmptyArray)

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Mutator class Mutator
class Literal < Mutator class Literal < self
# Represent mutations on fixnum literal # Represent mutations on fixnum literal
class Fixnum < Literal class Fixnum < self
handle(Rubinius::AST::FixnumLiteral) handle(Rubinius::AST::FixnumLiteral)

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Mutator class Mutator
class Literal < Mutator class Literal < self
# Represent mutations on fixnum literal # Represent mutations on fixnum literal
class Float < Literal class Float < self
handle(Rubinius::AST::FloatLiteral) handle(Rubinius::AST::FloatLiteral)

View file

@ -2,7 +2,7 @@ module Mutant
class Mutator class Mutator
class Literal class Literal
# Mutator for hash literal AST nodes # Mutator for hash literal AST nodes
class Hash < Mutator class Hash < self
handle(Rubinius::AST::HashLiteral) handle(Rubinius::AST::HashLiteral)

View file

@ -2,7 +2,7 @@ module Mutant
class Mutator class Mutator
class Literal class Literal
# Abstract literal range mutator # Abstract literal range mutator
class Range < Literal class Range < self
private private
@ -51,7 +51,7 @@ module Mutant
abstract_method :inverse_class abstract_method :inverse_class
# Mutator for range exclude literals # Mutator for range exclude literals
class Exclude < Range class Exclude < self
handle(Rubinius::AST::RangeExclude) handle(Rubinius::AST::RangeExclude)
@ -69,7 +69,7 @@ module Mutant
end end
# Mutator for range literals # Mutator for range literals
class Include < Range class Include < self
handle(Rubinius::AST::Range) handle(Rubinius::AST::Range)

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Mutator class Mutator
class Literal < Mutator class Literal < self
# Mutator for regexp literal AST nodes # Mutator for regexp literal AST nodes
class Regex < Literal class Regex < self
handle(Rubinius::AST::RegexLiteral) handle(Rubinius::AST::RegexLiteral)

View file

@ -2,7 +2,7 @@ module Mutant
class Mutator class Mutator
class Literal class Literal
# Represent mutations on string literal # Represent mutations on string literal
class String < Literal class String < self
handle(Rubinius::AST::StringLiteral) handle(Rubinius::AST::StringLiteral)

View file

@ -1,8 +1,8 @@
module Mutant module Mutant
class Mutator class Mutator
class Literal < Mutator class Literal < self
# Represent mutations on symbol literal # Represent mutations on symbol literal
class Symbol < Literal class Symbol < self
handle(Rubinius::AST::SymbolLiteral) handle(Rubinius::AST::SymbolLiteral)

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Mutator class Mutator
# Mutator that does do not mutations on ast # Mutator that does do not mutations on ast
class Noop < Mutator class Noop < self
# Literal references to self do not need to be mutated. # Literal references to self do not need to be mutated.
handle(Rubinius::AST::Self) handle(Rubinius::AST::Self)

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Mutator class Mutator
# Mutator for Rubinius::AST::When nodes # Mutator for Rubinius::AST::When nodes
class When < Mutator class When < self
handle(Rubinius::AST::When) handle(Rubinius::AST::When)
@ -33,7 +33,7 @@ module Mutant
end end
# Mutator for Rubinius::AST::ReceiverCase nodes # Mutator for Rubinius::AST::ReceiverCase nodes
class ReceiverCase < Mutator class ReceiverCase < self
handle(Rubinius::AST::ReceiverCase) handle(Rubinius::AST::ReceiverCase)

View file

@ -1,7 +1,7 @@
module Mutant module Mutant
class Runner class Runner
# Simple runner for rspec tests # Simple runner for rspec tests
class Rspec < Runner class Rspec < self
# Return error stream # Return error stream
# #