diff options
Diffstat (limited to 'test/ruby/test_regexp.rb')
-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) |