diff options
author | nagachika <nagachika@ruby-lang.org> | 2022-04-12 20:07:08 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2022-04-12 20:48:55 +0900 |
commit | 052ec6d2585c3ace95671013d336f5543624ef3d (patch) | |
tree | 91bcd23c4a22fc947adc44203261ec0c96df4cae /test/ruby | |
parent | 47c3f31fd93fc5bb60bf401b666b94e667ec717e (diff) |
Just free compiled pattern if no space is used
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_regexp.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 35d20eeda6..679a013cf0 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -1344,6 +1344,15 @@ class TestRegexp < Test::Unit::TestCase end end + def test_invalid_group + assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}") + begin; + assert_raise_with_message(RegexpError, /invalid conditional pattern/) do + Regexp.new("((?(1)x|x|)x)+") + end + end; + end + # This assertion is for porting x2() tests in testpy.py of Onigmo. def assert_match_at(re, str, positions, msg = nil) re = Regexp.new(re) unless re.is_a?(Regexp) |