parent
d032274141
commit
96a3a5162f
4 changed files with 33 additions and 1 deletions
|
@ -117,6 +117,7 @@ require 'mutant/mutator/node/send/conditional'
|
||||||
require 'mutant/mutator/node/send/attribute_assignment'
|
require 'mutant/mutator/node/send/attribute_assignment'
|
||||||
require 'mutant/mutator/node/send/index'
|
require 'mutant/mutator/node/send/index'
|
||||||
require 'mutant/mutator/node/when'
|
require 'mutant/mutator/node/when'
|
||||||
|
require 'mutant/mutator/node/class'
|
||||||
require 'mutant/mutator/node/define'
|
require 'mutant/mutator/node/define'
|
||||||
require 'mutant/mutator/node/mlhs'
|
require 'mutant/mutator/node/mlhs'
|
||||||
require 'mutant/mutator/node/nthref'
|
require 'mutant/mutator/node/nthref'
|
||||||
|
|
21
lib/mutant/mutator/node/class.rb
Normal file
21
lib/mutant/mutator/node/class.rb
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
module Mutant
|
||||||
|
class Mutator
|
||||||
|
class Node
|
||||||
|
# Namespace for class mutations
|
||||||
|
class Class < self
|
||||||
|
handle :class
|
||||||
|
|
||||||
|
children :klass, :parent, :body
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Emit mutations only for class body
|
||||||
|
#
|
||||||
|
# @return [undefined]
|
||||||
|
def dispatch
|
||||||
|
emit_body_mutations if body
|
||||||
|
end
|
||||||
|
end # Class
|
||||||
|
end # Node
|
||||||
|
end # Mutator
|
||||||
|
end # Mutant
|
|
@ -10,7 +10,7 @@ module Mutant
|
||||||
handle(
|
handle(
|
||||||
:ensure, :redo, :retry, :arg_expr, :blockarg,
|
:ensure, :redo, :retry, :arg_expr, :blockarg,
|
||||||
:kwrestarg, :undef, :module, :empty,
|
:kwrestarg, :undef, :module, :empty,
|
||||||
:alias, :for, :xstr, :back_ref, :class, :restarg,
|
:alias, :for, :xstr, :back_ref, :restarg,
|
||||||
:sclass, :match_with_lvasgn, :while_post,
|
:sclass, :match_with_lvasgn, :while_post,
|
||||||
:until_post, :preexe, :postexe, :iflipflop, :eflipflop, :kwsplat,
|
:until_post, :preexe, :postexe, :iflipflop, :eflipflop, :kwsplat,
|
||||||
:shadowarg, :rational, :complex, :__FILE__, :__LINE__
|
:shadowarg, :rational, :complex, :__FILE__, :__LINE__
|
||||||
|
|
10
meta/class.rb
Normal file
10
meta/class.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Mutant::Meta::Example.add :class do
|
||||||
|
source 'class Foo; bar; end'
|
||||||
|
|
||||||
|
mutation 'class Foo; nil; end'
|
||||||
|
mutation 'class Foo; self; end'
|
||||||
|
end
|
||||||
|
|
||||||
|
Mutant::Meta::Example.add :class do
|
||||||
|
source 'class Foo; end'
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue