lib/mutant/mutation.rb in mutant-0.8.8 vs lib/mutant/mutation.rb in mutant-0.8.9
- old
+ new
@@ -8,84 +8,75 @@
CODE_RANGE = (0..4).freeze
# Identification string
#
# @return [String]
- #
- # @api private
def identification
"#{self.class::SYMBOL}:#{subject.identification}:#{code}"
end
memoize :identification
# Mutation code
#
# @return [String]
- #
- # @api private
def code
sha1[CODE_RANGE]
end
memoize :code
# Normalized mutation source
#
# @return [String]
- #
- # @api private
def source
Unparser.unparse(node)
end
memoize :source
# Normalized original source
#
# @return [String]
- #
- # @api private
def original_source
subject.source
end
# Test if mutation is killed by test reports
#
# @param [Array<Report::Test>] test_reports
#
# @return [Boolean]
- #
- # @api private
def self.success?(test_result)
self::TEST_PASS_SUCCESS.equal?(test_result.passed)
end
# Insert mutated node
#
- # @return [self]
+ # @param kernel [Kernel]
#
- # @api private
- def insert
+ # @return [self]
+ def insert(kernel)
subject.prepare
- Loader::Eval.call(root, subject)
+ Loader.call(
+ binding: TOPLEVEL_BINDING,
+ kernel: kernel,
+ node: root,
+ subject: subject
+ )
self
end
private
# SHA1 sum of source and subject identification
#
# @return [String]
- #
- # @api private
def sha1
Digest::SHA1.hexdigest(subject.identification + CODE_DELIMITER + source)
end
memoize :sha1
# Mutated root node
#
# @return [Parser::AST::Node]
- #
- # @api private
def root
subject.context.root(node)
end
# Evil mutation that should case mutations to fail tests