lib/mutant/mutation.rb in mutant-0.8.22 vs lib/mutant/mutation.rb in mutant-0.8.23
- old
+ new
@@ -31,10 +31,18 @@
def source
Unparser.unparse(node)
end
memoize :source
+ # The monkeypatch to insert the mutation
+ #
+ # @return [String]
+ def monkeypatch
+ Unparser.unparse(subject.context.root(node))
+ end
+ memoize :monkeypatch
+
# Normalized original source
#
# @return [String]
def original_source
subject.source
@@ -57,11 +65,11 @@
def insert(kernel)
subject.prepare
Loader.call(
binding: TOPLEVEL_BINDING,
kernel: kernel,
- node: root,
+ source: monkeypatch,
subject: subject
)
self
end
@@ -72,16 +80,9 @@
# @return [String]
def sha1
Digest::SHA1.hexdigest(subject.identification + CODE_DELIMITER + source)
end
memoize :sha1
-
- # Mutated root node
- #
- # @return [Parser::AST::Node]
- def root
- subject.context.root(node)
- end
# Evil mutation that should case mutations to fail tests
class Evil < self
SYMBOL = 'evil'.freeze