1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Interpolated strings are no longer frozen with frozen-string-literal: true

* Remove freezestring instruction since this was the only usage for it.
* [Feature #17104]
This commit is contained in:
Benoit Daloze 2020-08-31 21:24:36 +02:00
parent fbba6bd4e3
commit 9b535f3ff7
Notes: git 2020-09-16 04:33:00 +09:00
10 changed files with 28 additions and 94 deletions

View file

@ -291,4 +291,21 @@ describe "Ruby String interpolation" do
-> { "#{a} #{b}" }.should raise_error(Encoding::CompatibilityError)
end
it "creates a non-frozen String" do
code = <<~'RUBY'
"a#{6*7}c"
RUBY
eval(code).should_not.frozen?
end
ruby_version_is "3.0" do
it "creates a non-frozen String when # frozen-string-literal: true is used" do
code = <<~'RUBY'
# frozen-string-literal: true
"a#{6*7}c"
RUBY
eval(code).should_not.frozen?
end
end
end