diff options
author | Benoit Daloze <eregontp@gmail.com> | 2021-02-27 13:00:26 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2021-02-27 13:00:26 +0100 |
commit | 36dde35e029c7a6607e6c674062ce6fc7a51c0bd (patch) | |
tree | 47f9c820a93d5b9a68f7e903cc01ee607913e2dd /spec/ruby/core/string | |
parent | dbea0be13dc1f44833eca43a73f3ab898fa27c15 (diff) | |
download | ruby-36dde35e029c7a6607e6c674062ce6fc7a51c0bd.tar.gz |
Update to ruby/spec@37e52e5
Diffstat (limited to 'spec/ruby/core/string')
-rw-r--r-- | spec/ruby/core/string/scrub_spec.rb | 14 |
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 |