summaryrefslogtreecommitdiff
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2022-03-28 15:03:17 +0900
committerYusuke Endoh <mame@ruby-lang.org>2022-03-30 16:50:46 +0900
commit2ade40276be9f60ed06e7011b41a4c90f03e59b4 (patch)
tree5ec8dca55bc9589a1734b2effac2adeb3d6d0360 /test/ruby/test_regexp.rb
parent34b288f8d471e3a3d34f2a63950b483594df282f (diff)
re.c: raise Regexp::TimeoutError instead of RuntimeError
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5703
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r--test/ruby/test_regexp.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 63572cf84a..fb989c74fa 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1465,7 +1465,7 @@ class TestRegexp < Test::Unit::TestCase
assert_equal(0.2, Regexp.timeout)
t = Time.now
- assert_raise_with_message(RuntimeError, "regexp match timeout") do
+ assert_raise_with_message(Regexp::TimeoutError, "regexp match timeout") do
# A typical ReDoS case
/^(a*)*$/ =~ "a" * 1000000 + "x"
end
@@ -1483,7 +1483,7 @@ class TestRegexp < Test::Unit::TestCase
re = Regexp.new("^a*b?a*$", timeout: 0.2)
t = Time.now
- assert_raise_with_message(RuntimeError, "regexp match timeout") do
+ assert_raise_with_message(Regexp::TimeoutError, "regexp match timeout") do
re =~ "a" * 1000000 + "x"
end
t = Time.now - t