summaryrefslogtreecommitdiff
path: root/spec/ruby/language
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-08-31 21:24:36 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-09-15 21:32:35 +0200
commit9b535f3ff7c2f48e34dd44564df7adc723b81276 (patch)
treeea88978c58cd1cc371e6c51a163edb8e3c64e8c1 /spec/ruby/language
parentfbba6bd4e3dff7a61965208fecae908f10c4edbe (diff)
Interpolated strings are no longer frozen with frozen-string-literal: true
* Remove freezestring instruction since this was the only usage for it. * [Feature #17104]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3488
Diffstat (limited to 'spec/ruby/language')
-rw-r--r--spec/ruby/language/string_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/language/string_spec.rb b/spec/ruby/language/string_spec.rb
index d19b909cab..0178083f58 100644
--- a/spec/ruby/language/string_spec.rb
+++ b/spec/ruby/language/string_spec.rb
@@ -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