From 78ff9b719c236b56956d446053256f8e30edf0c3 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 8 Oct 2021 14:08:03 +0900 Subject: [PATCH] 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`. --- string.c | 8 +++++--- test/ruby/test_string.rb | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/string.c b/string.c index 7890e6cc88..13079251d4 100644 --- a/string.c +++ b/string.c @@ -10237,12 +10237,14 @@ rb_str_end_with(int argc, VALUE *argv, VALUE str) for (i=0; i