Class: Mutant::Mutation Private
- Inherits:
-
Object
- Object
- Mutant::Mutation
- Includes:
- AbstractType, Adamantium::Flat
- Defined in:
- lib/mutant/mutation.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represent a mutated node with its subject
Defined Under Namespace
Constant Summary collapse
- CODE_DELIMITER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"\0"- CODE_RANGE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
(0..4).freeze
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
private
Mutation identification code.
-
#identification ⇒ String
readonly
private
Identification string.
-
#monkeypatch ⇒ String
readonly
private
The monkeypatch to insert the mutation.
-
#source ⇒ String
readonly
private
Normalized mutation source.
Class Method Summary collapse
-
.success?(test_result) ⇒ Boolean
private
Test if mutation is killed by test reports.
Instance Method Summary collapse
-
#initialize(subject, node) ⇒ Mutation
constructor
private
A new instance of Mutation.
-
#insert(kernel) ⇒ Loader::Result
private
Insert mutated node.
-
#original_source ⇒ String
private
Normalized original source.
Constructor Details
#initialize(subject, node) ⇒ Mutation
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.
Returns a new instance of Mutation.
12 13 14 15 16 17 18 19 |
# File 'lib/mutant/mutation.rb', line 12 def initialize(subject, node) super(subject, node) @source = Unparser.unparse(node) @code = sha1[CODE_RANGE] @identification = "#{self.class::SYMBOL}:#{subject.identification}:#{code}" @monkeypatch = Unparser.unparse(subject.context.root(node)) end |
Instance Attribute Details
#code ⇒ String (readonly)
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.
Mutation identification code
24 25 26 |
# File 'lib/mutant/mutation.rb', line 24 def code @code end |
#identification ⇒ String (readonly)
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.
Identification string
34 35 36 |
# File 'lib/mutant/mutation.rb', line 34 def identification @identification end |
#monkeypatch ⇒ String (readonly)
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.
The monkeypatch to insert the mutation
39 40 41 |
# File 'lib/mutant/mutation.rb', line 39 def monkeypatch @monkeypatch end |
#source ⇒ String (readonly)
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.
Normalized mutation source
29 30 31 |
# File 'lib/mutant/mutation.rb', line 29 def source @source end |
Class Method Details
.success?(test_result) ⇒ Boolean
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.
Test if mutation is killed by test reports
53 54 55 |
# File 'lib/mutant/mutation.rb', line 53 def self.success?(test_result) self::TEST_PASS_SUCCESS.equal?(test_result.passed) end |
Instance Method Details
#insert(kernel) ⇒ Loader::Result
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.
Insert mutated node
62 63 64 65 66 67 68 69 70 |
# File 'lib/mutant/mutation.rb', line 62 def insert(kernel) subject.prepare Loader.call( binding: TOPLEVEL_BINDING, kernel: kernel, source: monkeypatch, subject: subject ) end |
#original_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.
Normalized original source
44 45 46 |
# File 'lib/mutant/mutation.rb', line 44 def original_source subject.source end |