Merge pull request #818 from mbj/fix/frozen-string-literal-reproduction

Change to always insert mutations with frozen string literals
This commit is contained in:
Markus Schirp 2018-12-24 16:05:22 +00:00 committed by GitHub
commit ff0503f0f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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