Skip to content

Commit

Permalink
Change back to lazy mutation
Browse files Browse the repository at this point in the history
* It turns out that the original reason for the change to AOT
  mutation details is not valid anymore after the MRI bug that causes
  the VM to get stuck was reproduced outside memoizable sharing.
  • Loading branch information
mbj committed Dec 8, 2020
1 parent af052b4 commit 8bd300e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
@@ -1,3 +1,9 @@
# v0.10.16 2020-12-09

* Minor performance improvements on small runs.

[#1145](https://github.com/mbj/mutant/pull/1145)

# v0.10.15 2020-12-07

* Add support for incremental mutation testing when the working directory
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
mutant (0.10.15)
mutant (0.10.16)
abstract_type (~> 0.0.7)
adamantium (~> 0.2.0)
anima (~> 0.3.1)
Expand Down
29 changes: 16 additions & 13 deletions lib/mutant/mutation.rb
Expand Up @@ -9,34 +9,37 @@ class Mutation
CODE_DELIMITER = "\0"
CODE_RANGE = (0..4).freeze

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

# Mutation identification code
#
# @return [String]
attr_reader :code
def code
sha1[CODE_RANGE]
end
memoize :code

# Normalized mutation source
#
# @return [String]
attr_reader :source
def source
Unparser.unparse(node)
end
memoize :source

# Identification string
#
# @return [String]
attr_reader :identification
def identification
"#{self.class::SYMBOL}:#{subject.identification}:#{code}"
end
memoize :identification

# The monkeypatch to insert the mutation
#
# @return [String]
attr_reader :monkeypatch
def monkeypatch
Unparser.unparse(subject.context.root(node))
end
memoize :monkeypatch

# Normalized original source
#
Expand Down
2 changes: 1 addition & 1 deletion lib/mutant/version.rb
Expand Up @@ -2,5 +2,5 @@

module Mutant
# Current mutant version
VERSION = '0.10.15'
VERSION = '0.10.16'
end # Mutant

0 comments on commit 8bd300e

Please sign in to comment.