Class: Mutant::Subject

Inherits:
Object
  • Object
show all
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

Method

Defined Under Namespace

Classes: Method

Instance Method Summary collapse

Instance Method Details

#expressionExpression

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



109
# File 'lib/mutant/subject.rb', line 109

abstract_method :expression

#identificationString

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



75
76
77
# File 'lib/mutant/subject.rb', line 75

def identification
  "#{expression.syntax}:#{source_path}:#{source_line}"
end

#match_expressionsEnumerable<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



117
# File 'lib/mutant/subject.rb', line 117

abstract_method :match_expressions

#mutationsEnumerable<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

#prepareself

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



55
56
57
# File 'lib/mutant/subject.rb', line 55

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



99
100
101
# File 'lib/mutant/subject.rb', line 99

def root(node)
  context.root(node)
end

#sourceString

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



86
87
88
# File 'lib/mutant/subject.rb', line 86

def source
  Unparser.unparse(node)
end

#source_lineFixnum

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



65
66
67
# File 'lib/mutant/subject.rb', line 65

def source_line
  node.location.expression.line
end

#source_pathString

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

#testsArray<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



37
38
39
40
41
42
43
44
45
46
# File 'lib/mutant/subject.rb', line 37

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