Class: Mutant::Mutation Private
- Inherits:
-
Object
- Object
- Mutant::Mutation
- Includes:
- Unparser::AbstractType, Unparser::Adamantium
- Defined in:
- lib/mutant/mutation.rb,
lib/mutant/mutation/config.rb,
lib/mutant/mutation/runner.rb,
lib/mutant/mutation/operators.rb,
lib/mutant/mutation/runner/sink.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
Modules: Runner Classes: Config, Evil, Neutral, Noop, Operators
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.
(..4)
Class Method Summary collapse
-
.success?(test_result) ⇒ Boolean
private
Test if mutation is killed by test reports.
Instance Method Summary collapse
-
#code ⇒ String
private
Mutation identification code.
-
#diff ⇒ String?
private
Rendered mutation diff.
-
#identification ⇒ String
private
Identification string.
-
#insert(kernel) ⇒ Loader::Result
private
Insert mutated node.
-
#monkeypatch ⇒ String
private
The monkeypatch to insert the mutation.
-
#original_source ⇒ String
private
Normalized original source.
-
#source ⇒ String
private
Normalized mutation source.
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
56 57 58 |
# File 'lib/mutant/mutation.rb', line 56 def self.success?(test_result) self::TEST_PASS_SUCCESS.equal?(test_result.passed) end |
Instance Method Details
#code ⇒ 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.
Mutation identification code
15 16 17 |
# File 'lib/mutant/mutation.rb', line 15 def code sha1[CODE_RANGE] end |
#diff ⇒ 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.
Rendered mutation diff
82 83 84 |
# File 'lib/mutant/mutation.rb', line 82 def diff Unparser::Diff.build(original_source, source) end |
#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.
Identification string
31 32 33 |
# File 'lib/mutant/mutation.rb', line 31 def identification "#{self.class::SYMBOL}:#{subject.identification}:#{code}" end |
#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
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/mutant/mutation.rb', line 65 def insert(kernel) subject.prepare Loader.call( binding: TOPLEVEL_BINDING, kernel:, source: monkeypatch, subject: ).fmap do subject.post_insert nil end end |
#monkeypatch ⇒ 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.
The monkeypatch to insert the mutation
39 40 41 |
# File 'lib/mutant/mutation.rb', line 39 def monkeypatch Unparser.unparse(subject.context.root(node)) 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
47 48 49 |
# File 'lib/mutant/mutation.rb', line 47 def original_source subject.source 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.
Normalized mutation source
23 24 25 |
# File 'lib/mutant/mutation.rb', line 23 def source Unparser.unparse(node) end |