diff options
author | Yusuke Endoh <[email protected]> | 2022-04-05 14:07:25 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2022-04-05 14:08:07 +0900 |
commit | 1ac839dc3a70fa5dd18e67a37026234514b04b83 () | |
tree | 4f21cc51a736c07e2d4b1289c733d0f276fafc8a /test/ruby/test_regexp.rb | |
parent | 18044f4fbbfdef27b1e41c109d63c276026008c5 (diff) |
Apply timescale configuration for tests of Regexp.timeout
-rw-r--r-- | test/ruby/test_regexp.rb | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -1464,8 +1464,10 @@ class TestRegexp < Test::Unit::TestCase def test_s_timeout assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") begin; - Regexp.timeout = 0.2 - assert_equal(0.2, Regexp.timeout) t = Time.now assert_raise_with_message(Regexp::TimeoutError, "regexp match timeout") do @@ -1474,16 +1476,19 @@ class TestRegexp < Test::Unit::TestCase end t = Time.now - t - assert_in_delta(0.2, t, 0.1) end; end def test_timeout assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") begin; - Regexp.timeout = 3 # This should be ignored - re = Regexp.new("^a*b?a*$", timeout: 0.2) t = Time.now assert_raise_with_message(Regexp::TimeoutError, "regexp match timeout") do @@ -1491,7 +1496,7 @@ class TestRegexp < Test::Unit::TestCase end t = Time.now - t - assert_in_delta(0.2, t, 0.1) end; end end |