1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2021-06-02 14:34:07 +02:00
parent a4fbc7e288
commit 22e2a6a999
66 changed files with 943 additions and 167 deletions

View file

@ -11,6 +11,19 @@ describe "String#rpartition with String" do
"hello".rpartition("hello").should == ["", "hello", ""]
end
it "returns original string if regexp doesn't match" do
"hello".rpartition("/x/").should == ["", "", "hello"]
end
it "returns new object if doesn't match" do
str = "hello"
str.rpartition("/no_match/").last.should_not.equal?(str)
end
it "handles multibyte string correctly" do
"ユーザ@ドメイン".rpartition(/@/).should == ["ユーザ", "@", "ドメイン"]
end
it "accepts regexp" do
"hello!".rpartition(/l./).should == ["hel", "lo", "!"]
end