Class: Mutant::Subject
- Inherits:
-
Object
- Object
- Mutant::Subject
- Includes:
- AbstractType, Adamantium::Flat, Enumerable
- Defined in:
- lib/mutant/subject.rb,
lib/mutant/subject/method.rb,
lib/mutant/subject/method/instance.rb,
lib/mutant/subject/method/singleton.rb
Overview
Subject of a mutation
Direct Known Subclasses
Defined Under Namespace
Classes: Method
Instance Method Summary collapse
-
#expression ⇒ Expression
private
Return match expression.
-
#identification ⇒ String
private
Return subject identification.
-
#match_expressions ⇒ Enumerable<Expression>
private
Return match expressions.
-
#mutations ⇒ Enumerable<Mutation>, undefined
private
Return mutations.
-
#prepare ⇒ self
private
Prepare the subject for the insertion of mutation.
-
#root(node) ⇒ Parser::AST::Node
private
Return root AST for node.
-
#source ⇒ String
private
Return source representation of ast.
-
#source_line ⇒ Fixnum
private
Return source line.
-
#source_path ⇒ String
private
Return source path.
-
#tests ⇒ Array<Test>
private
Return tests for mutation.
Instance Method Details
#expression ⇒ Expression
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return match expression
113 |
# File 'lib/mutant/subject.rb', line 113 abstract_method :expression |
#identification ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return subject identification
79 80 81 |
# File 'lib/mutant/subject.rb', line 79 def identification "#{expression.syntax}:#{source_path}:#{source_line}" end |
#match_expressions ⇒ Enumerable<Expression>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return match expressions
121 122 123 |
# File 'lib/mutant/subject.rb', line 121 def match_expressions [expression].concat(context.match_expressions) end |
#mutations ⇒ Enumerable<Mutation>, undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return mutations
14 15 16 17 18 |
# File 'lib/mutant/subject.rb', line 14 def mutations mutations = [neutral_mutation] generate_mutations(mutations) mutations end |
#prepare ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prepare the subject for the insertion of mutation
59 60 61 |
# File 'lib/mutant/subject.rb', line 59 def prepare self end |
#root(node) ⇒ Parser::AST::Node
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return root AST for node
103 104 105 |
# File 'lib/mutant/subject.rb', line 103 def root(node) context.root(node) end |
#source ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return source representation of ast
90 91 92 |
# File 'lib/mutant/subject.rb', line 90 def source Unparser.unparse(node) end |
#source_line ⇒ Fixnum
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return source line
69 70 71 |
# File 'lib/mutant/subject.rb', line 69 def source_line node.location.expression.line end |
#source_path ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return source path
27 28 29 |
# File 'lib/mutant/subject.rb', line 27 def source_path context.source_path end |
#tests ⇒ Array<Test>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return tests for mutation
TODO: This logic is now centralized but still fucked.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/mutant/subject.rb', line 41 def tests match_expressions.each do |match_expression| tests = config.integration.all_tests.select do |test| match_expression.prefix?(test.expression) end return tests if tests.any? end EMPTY_ARRAY end |