diff --git a/core/symbol/shared/id2name.rb b/core/symbol/shared/id2name.rb index d012b7634..00a9c7d7d 100644 --- a/core/symbol/shared/id2name.rb +++ b/core/symbol/shared/id2name.rb @@ -13,4 +13,18 @@ symbol.send(@method).encoding.should == Encoding::US_ASCII end + + ruby_version_is "3.4" do + it "warns about mutating returned string" do + -> { :bad!.send(@method).upcase! }.should complain(/warning: string returned by :bad!.to_s will be frozen in the future/) + end + + it "does not warn about mutation when Warning[:deprecated] is false" do + deprecated = Warning[:deprecated] + Warning[:deprecated] = false + -> { :bad!.send(@method).upcase! }.should_not complain + ensure + Warning[:deprecated] = deprecated + end + end end