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
* Improved isolation error reporting

View file

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

View file

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