summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2021-10-08 14:08:03 +0900
committerNobuyoshi Nakada <[email protected]>2021-10-08 14:08:03 +0900
commit78ff9b719c236b56956d446053256f8e30edf0c3 (patch)
tree6b0b5e9339bc22a1f09708909dae1c24b505dc9f /test/ruby/test_string.rb
parentd0268c5ec20784cf5ed42caf43b076846ae6255a (diff)
Add tests for the edge caces of `String#end_with?`
Also, check if a suffix is empty, to guarantee the assumption of `onigenc_get_left_adjust_char_head` that `*s` is always accessible, even in the case of `SHARABLE_MIDDLE_SUBSTRING`.
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 12e4b0fe2a..3f7c06e075 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1180,6 +1180,8 @@ CODE
assert_send([S("hello"), :end_with?, S("llo")])
assert_not_send([S("hello"), :end_with?, S("ll")])
assert_send([S("hello"), :end_with?, S("el"), S("lo")])
+ assert_send([S("hello"), :end_with?, S("")])
+ assert_not_send([S("hello"), :end_with?])
bug5536 = '[ruby-core:40623]'
assert_raise(TypeError, bug5536) {S("str").end_with? :not_convertible_to_string}