diff options
Diffstat (limited to 'spec/ruby/core/string/rpartition_spec.rb')
-rw-r--r-- | spec/ruby/core/string/rpartition_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/string/rpartition_spec.rb b/spec/ruby/core/string/rpartition_spec.rb index c6428636f6..fc37f8b427 100644 --- a/spec/ruby/core/string/rpartition_spec.rb +++ b/spec/ruby/core/string/rpartition_spec.rb @@ -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 |