aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2021-02-27 13:00:26 +0100
committerBenoit Daloze <eregontp@gmail.com>2021-02-27 13:00:26 +0100
commit36dde35e029c7a6607e6c674062ce6fc7a51c0bd (patch)
tree47f9c820a93d5b9a68f7e903cc01ee607913e2dd /spec/ruby/core/string
parentdbea0be13dc1f44833eca43a73f3ab898fa27c15 (diff)
downloadruby-36dde35e029c7a6607e6c674062ce6fc7a51c0bd.tar.gz
Update to ruby/spec@37e52e5
Diffstat (limited to 'spec/ruby/core/string')
-rw-r--r--spec/ruby/core/string/scrub_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/string/scrub_spec.rb b/spec/ruby/core/string/scrub_spec.rb
index 86fd4e85ba..b513acfb70 100644
--- a/spec/ruby/core/string/scrub_spec.rb
+++ b/spec/ruby/core/string/scrub_spec.rb
@@ -105,4 +105,18 @@ describe "String#scrub!" do
input.scrub! { |b| "<?>" }
input.should == "a<?>"
end
+
+ it "maintains the state of frozen strings that are already valid" do
+ input = "a"
+ input.freeze
+ input.scrub!
+ input.frozen?.should be_true
+ end
+
+ it "preserves the instance variables of already valid strings" do
+ input = "a"
+ input.instance_variable_set(:@a, 'b')
+ input.scrub!
+ input.instance_variable_get(:@a).should == 'b'
+ end
end