Skip to content

Commit

Permalink
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/ruby/core/string/gsub_spec.rb
Original file line number Diff line number Diff line change
@@ -43,6 +43,9 @@

str = "hello homely world. hah!"
str.gsub(/\Ah\S+\s*/, "huh? ").should == "huh? homely world. hah!"

str = "¿por qué?"
str.gsub(/([a-z\d]*)/, "*").should == "*¿** **é*?*"
end

it "ignores a block if supplied" do
@@ -583,6 +586,12 @@ def obj.to_s() "ok" end
a.should == "h*ll*"
end

it "modifies self in place with multi-byte characters and returns self" do
a = "¿por qué?"
a.gsub!(/([a-z\d]*)/, "*").should equal(a)
a.should == "*¿** **é*?*"
end

it "taints self if replacement is tainted" do
a = "hello"
a.gsub!(/./.taint, "foo").tainted?.should == false

0 comments on commit 629d5b3

Please sign in to comment.