summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2022-05-01 16:36:46 +0900
committernagachika <nagachika@ruby-lang.org>2022-05-01 16:37:00 +0900
commit76b52b42a3453488e744937802cf154733aa1e6a (patch)
treeed5dc09d203c5f0a2e96ca25e8c7f2de5c4746db /test
parent322dfc9accc638b9643e2acd0df1d7c6cfdf8157 (diff)
merge cf2bbcfff2985c116552967c7c4522f4630f2d18 partially.
Add the relevant test code for 73f45e5e96ccc13a131f7c0122cf8600ce5b930f.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_regexp.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 2bf4649f14..b4e4f725b3 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1396,6 +1396,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)