From fb4ffce0dd8cae3b7d0141d3b1ea3f0ab710a45a Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Tue, 28 Mar 2023 14:25:13 +0900 Subject: merge revision(s) 680bd9027f8cb7977bbc216609db2f4e3cf199a8: [Backport #19471] [Bug #19471] `Regexp.compile` should handle keyword arguments As well as `Regexp.new`, it should pass keyword arguments to the `Regexp#initialize` method. --- re.c | 2 +- test/ruby/test_regexp.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) --- test/ruby/test_regexp.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index ccdd289dcb..80b652773d 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -713,6 +713,11 @@ class TestRegexp < Test::Unit::TestCase assert_equal(//n, Regexp.new("", Regexp::NOENCODING, timeout: 1)) assert_equal(arg_encoding_none, Regexp.new("", Regexp::NOENCODING).options) + + assert_nil(Regexp.new("").timeout) + assert_equal(1.0, Regexp.new("", timeout: 1.0).timeout) + assert_nil(Regexp.compile("").timeout) + assert_equal(1.0, Regexp.compile("", timeout: 1.0).timeout) end assert_deprecated_warning(/3\.3/) do -- cgit v1.2.3