re.c: do not escape terminator in Regexp.union

* re.c (rb_reg_str_with_term): change terminator.

* re.c (rb_reg_s_union): terminator in source string does not need
  to be escaped.  terminators are outside of regexp source itself.
  [ruby-core:86149] [Bug #14608]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-03-16 13:37:44 +00:00
parent 0eddedbf5c
commit 8a8f542c43
2 changed files with 24 additions and 12 deletions

View file

@ -90,6 +90,11 @@ class TestRegexp < Test::Unit::TestCase
rescue ArgumentError
:ok
end
re = Regexp.union(/\//, "")
re2 = eval(re.inspect)
assert_equal(re.to_s, re2.to_s)
assert_equal(re.source, re2.source)
assert_equal(re, re2)
end
def test_word_boundary