1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

re.c: options for sub-regexp

* re.c (rb_reg_to_s): needs embedded options to check syntax of
  sub-regexp.  [ruby-core:82328] [Bug #13798]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-08-11 02:05:24 +00:00
parent 890ae326e5
commit d96eba12c2
2 changed files with 7 additions and 1 deletions

2
re.c
View file

@ -606,7 +606,7 @@ rb_reg_to_s(VALUE re)
++ptr;
len -= 2;
err = onig_new(&rp, ptr, ptr + len, ONIG_OPTION_DEFAULT,
err = onig_new(&rp, ptr, ptr + len, options,
enc, OnigDefaultSyntax, NULL);
onig_free(rp);
ruby_verbose = verbose;

View file

@ -74,6 +74,12 @@ class TestRegexp < Test::Unit::TestCase
end
end
def test_to_s_extended_subexp
re = /#\g#{"\n"}/x
re = /#{re}/
assert_warn('', '[ruby-core:82328] [Bug #13798]') {re.to_s}
end
def test_union
assert_equal :ok, begin
Regexp.union(