Change to always insert mutations with frozen string literals

This commit is contained in:
Markus Schirp 2018-12-24 16:00:35 +00:00
parent fcca1918a4
commit 1768b93faa
3 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,7 @@
# v0.8.24 2018-12-xx
* Change to always insert mutations with frozen string literals
# v0.8.23 2018-12-23 # v0.8.23 2018-12-23
* Improved isolation error reporting * Improved isolation error reporting

View file

@ -5,6 +5,10 @@ module Mutant
class Loader class Loader
include Anima.new(:binding, :kernel, :source, :subject) include Anima.new(:binding, :kernel, :source, :subject)
FROZEN_STRING_FORMAT = "# frozen_string_literal: true\n%s"
private_constant(*constants(false))
# Call loader # Call loader
# #
# @return [self] # @return [self]
@ -19,7 +23,7 @@ module Mutant
# @return [undefined] # @return [undefined]
def call def call
kernel.eval( kernel.eval(
source, FROZEN_STRING_FORMAT % source,
binding, binding,
subject.source_path.to_s, subject.source_path.to_s,
subject.source_line subject.source_line

View file

@ -29,7 +29,7 @@ RSpec.describe Mutant::Loader, '.call' do
it 'performs expected kernel interaction' do it 'performs expected kernel interaction' do
expect(kernel).to receive(:eval) expect(kernel).to receive(:eval)
.with( .with(
source, "# frozen_string_literal: true\n#[InstanceDouble(String) (anonymous)]",
binding, binding,
path_str, path_str,
line line