summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/gsub_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-11-27 14:55:31 +0100
committerBenoit Daloze <eregontp@gmail.com>2020-11-27 14:55:31 +0100
commitf02d2f82bf10351f480ea312f40cb840e2437f93 (patch)
tree0b53098bffe6dacadb09880183ebcaea06e95153 /spec/ruby/core/string/gsub_spec.rb
parentf0bfa266d70651dc295a63b026938b246693499b (diff)
Update to ruby/spec@ac878ad
Diffstat (limited to 'spec/ruby/core/string/gsub_spec.rb')
-rw-r--r--spec/ruby/core/string/gsub_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/string/gsub_spec.rb b/spec/ruby/core/string/gsub_spec.rb
index 54a2be0fed..6789199ff3 100644
--- a/spec/ruby/core/string/gsub_spec.rb
+++ b/spec/ruby/core/string/gsub_spec.rb
@@ -475,6 +475,11 @@ describe "String#gsub with pattern and block" do
offsets.should == [[1, 2], [4, 5]]
end
+ it "does not set $~ for procs created from methods" do
+ str = "hello"
+ str.gsub("l", &StringSpecs::SpecialVarProcessor.new.method(:process)).should == "he<unset><unset>o"
+ end
+
it "restores $~ after leaving the block" do
[/./, "l"].each do |pattern|
old_md = nil