Prevent syntax warnings in test/ruby/test_regexp.rb

This commit is contained in:
Yusuke Endoh 2024-01-11 17:04:13 +09:00
Родитель 60844ecf2e
Коммит 78cd5b3657
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -716,7 +716,7 @@ class TestRegexp < Test::Unit::TestCase
h = {}
ObjectSpace.count_objects(h)
prev_matches = h[:T_MATCH] || 0
md = /[A-Z]/.match('1') # no match
_md = /[A-Z]/.match('1') # no match
ObjectSpace.count_objects(h)
new_matches = h[:T_MATCH] || 0
assert_equal prev_matches, new_matches, "Bug [#20104]"
@ -2009,11 +2009,11 @@ class TestRegexp < Test::Unit::TestCase
end
def test_bug_20098 # [Bug #20098]
assert /a((.|.)|bc){,4}z/.match? 'abcbcbcbcz'
assert /a(b+?c*){4,5}z/.match? 'abbbccbbbccbcbcz'
assert /a(b+?(.|.)){2,3}z/.match? 'abbbcbbbcbbbcz'
assert /a(b*?(.|.)[bc]){2,5}z/.match? 'abcbbbcbcccbcz'
assert /^(?:.+){2,4}?b|b/.match? "aaaabaa"
assert(/a((.|.)|bc){,4}z/.match? 'abcbcbcbcz')
assert(/a(b+?c*){4,5}z/.match? 'abbbccbbbccbcbcz')
assert(/a(b+?(.|.)){2,3}z/.match? 'abbbcbbbcbbbcz')
assert(/a(b*?(.|.)[bc]){2,5}z/.match? 'abcbbbcbcccbcz')
assert(/^(?:.+){2,4}?b|b/.match? "aaaabaa")
end
def test_linear_time_p