summaryrefslogtreecommitdiff
path: root/spec/ruby/language/string_spec.rb
diff options
context:
space:
mode:
authorAndrew Konchin <andry.konchin@gmail.com>2024-04-01 17:52:57 +0300
committerBenoit Daloze <eregontp@gmail.com>2024-04-02 10:50:30 +0200
commit1e5949bd60464ed8767fcc8aabc79eeea5727daa (patch)
tree1c24f4ca43c05a6093b2e49fb575acf44634cbc8 /spec/ruby/language/string_spec.rb
parent8b55aaa85ca3b5333e6659f0f0b1eabdd0b9491b (diff)
Update to ruby/spec@573cf97
Diffstat (limited to 'spec/ruby/language/string_spec.rb')
-rw-r--r--spec/ruby/language/string_spec.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/spec/ruby/language/string_spec.rb b/spec/ruby/language/string_spec.rb
index 1a1cd35850..083a7f5db5 100644
--- a/spec/ruby/language/string_spec.rb
+++ b/spec/ruby/language/string_spec.rb
@@ -231,9 +231,16 @@ describe "Ruby String literals" do
ruby_exe(fixture(__FILE__, "freeze_magic_comment_across_files.rb")).chomp.should == "true"
end
- it "produce different objects for literals with the same content in different files if the other file doesn't have the comment" do
- frozen_string_literal = "test".frozen? && "test".equal?("test")
- ruby_exe(fixture(__FILE__, "freeze_magic_comment_across_files_no_comment.rb")).chomp.should == (!frozen_string_literal).to_s
+ guard -> { !(eval("'test'").frozen? && "test".equal?("test")) } do
+ it "produces different objects for literals with the same content in different files if the other file doesn't have the comment and String literals aren't frozen by default" do
+ ruby_exe(fixture(__FILE__, "freeze_magic_comment_across_files_no_comment.rb")).chomp.should == "true"
+ end
+ end
+
+ guard -> { eval("'test'").frozen? && "test".equal?("test") } do
+ it "produces the same objects for literals with the same content in different files if the other file doesn't have the comment and String literals are frozen by default" do
+ ruby_exe(fixture(__FILE__, "freeze_magic_comment_across_files_no_comment.rb")).chomp.should == "false"
+ end
end
it "produce different objects for literals with the same content in different files if they have different encodings" do