aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-03-03 11:07:36 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-03-03 15:27:37 +0900
commit680bd9027f8cb7977bbc216609db2f4e3cf199a8 (patch)
tree80354a5fea856f47a8bc2e1b82141a66dffd7e78 /test/ruby/test_regexp.rb
parent103a65316c103253059ca4c49359dc7eb0043a4d (diff)
downloadruby-680bd9027f8cb7977bbc216609db2f4e3cf199a8.tar.gz
[Bug #19471] `Regexp.compile` should handle keyword arguments
As well as `Regexp.new`, it should pass keyword arguments to the `Regexp#initialize` method.
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r--test/ruby/test_regexp.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 4a2ee9dc4c..37375c0e3a 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -700,6 +700,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_raise(RegexpError) { Regexp.new(")(") }