diff options
Diffstat (limited to 'spec/ruby/shared/string/end_with.rb')
-rw-r--r-- | spec/ruby/shared/string/end_with.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/ruby/shared/string/end_with.rb b/spec/ruby/shared/string/end_with.rb index 5f2a011235..0e4c1386e8 100644 --- a/spec/ruby/shared/string/end_with.rb +++ b/spec/ruby/shared/string/end_with.rb @@ -38,7 +38,7 @@ describe :end_with, shared: true do it "uses only the needed arguments" do find = mock('h') find.should_not_receive(:to_str) - "hello".send(@method).should.end_with?("o",find) + "hello".send(@method).should.end_with?("o", find) end it "works for multibyte strings" do @@ -51,4 +51,11 @@ describe :end_with, shared: true do "あれ".send(@method).end_with?(pat) end.should raise_error(Encoding::CompatibilityError) end + + it "checks that we are starting to match at the head of a character" do + "\xC3\xA9".send(@method).should_not.end_with?("\xA9") + "\xe3\x81\x82".send(@method).should_not.end_with?("\x82") + "ab".force_encoding("UTF-16BE").send(@method).should_not.end_with?( + "b".force_encoding("UTF-16BE")) + end end |