summaryrefslogtreecommitdiff
path: root/spec/ruby/language
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-05-02 16:03:14 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-05-02 16:03:14 +0200
commitc9213aa864fb8527388679c21f1ea8ce129e2f1a (patch)
treea6ef2403c73ef61a2aaddad6c0f8d9d09e4e6151 /spec/ruby/language
parenta68ddf42879005905176bc38285906fe01707aff (diff)
Update to ruby/spec@d394dfd
Diffstat (limited to 'spec/ruby/language')
-rw-r--r--spec/ruby/language/string_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/language/string_spec.rb b/spec/ruby/language/string_spec.rb
index 68c5fd221b..d19b909cab 100644
--- a/spec/ruby/language/string_spec.rb
+++ b/spec/ruby/language/string_spec.rb
@@ -32,6 +32,11 @@ describe "Ruby character strings" do
"#@my_ip".should == 'xxx'
end
+ it "does not interpolate invalid variable names" do
+ "#@".should == '#@'
+ "#$%".should == '#$%'
+ end
+
it "has characters [.(=?!# end simple # interpolation" do
"#@ip[".should == 'xxx['
"#@ip.".should == 'xxx.'
@@ -260,6 +265,12 @@ describe "Ruby String literals" do
end
describe "Ruby String interpolation" do
+ it "permits an empty expression" do
+ s = "#{}" # rubocop:disable Lint/EmptyInterpolation
+ s.should.empty?
+ s.should_not.frozen?
+ end
+
it "returns a string with the source encoding by default" do
"a#{"b"}c".encoding.should == Encoding::BINARY
eval('"a#{"b"}c"'.force_encoding("us-ascii")).encoding.should == Encoding::US_ASCII