mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) d8189ed23f
: [Backport #18670]
Return only captured range in `MatchData` [Bug #18670] --- re.c | 2 +- test/ruby/test_regexp.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
This commit is contained in:
parent
4d26cfb2fe
commit
1cfc139f6d
3 changed files with 4 additions and 3 deletions
2
re.c
2
re.c
|
@ -2120,7 +2120,7 @@ match_aref(int argc, VALUE *argv, VALUE match)
|
|||
else if (beg > num_regs) {
|
||||
return Qnil;
|
||||
}
|
||||
else if (beg+len > num_regs) {
|
||||
if (beg+len > num_regs) {
|
||||
len = num_regs - beg;
|
||||
}
|
||||
return match_ary_subseq(match, beg, len, Qnil);
|
||||
|
|
|
@ -467,6 +467,7 @@ class TestRegexp < Test::Unit::TestCase
|
|||
assert_nil(m[5])
|
||||
assert_raise(IndexError) { m[:foo] }
|
||||
assert_raise(TypeError) { m[nil] }
|
||||
assert_equal(["baz", nil], m[-2, 3])
|
||||
end
|
||||
|
||||
def test_match_values_at
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 3
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 44
|
||||
#define RUBY_PATCHLEVEL 45
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2022
|
||||
#define RUBY_RELEASE_MONTH 9
|
||||
#define RUBY_RELEASE_DAY 3
|
||||
#define RUBY_RELEASE_DAY 4
|
||||
|
||||
#include "ruby/version.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue