1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-05-02 16:03:14 +02:00
parent a68ddf4287
commit c9213aa864
44 changed files with 904 additions and 20 deletions

View file

@ -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