aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-21 07:48:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-21 07:48:11 +0000
commitebd866348254f245f6d689ece6781499489aa411 (patch)
treec469f0479bf606f2974af1791e13606e759cfd93 /test/ruby/test_regexp.rb
parent1dfb5bb7fc6ff3b32dbf70ed02936a98980ed19d (diff)
downloadruby-ebd866348254f245f6d689ece6781499489aa411.tar.gz
parse.y: escape all closing parens
* parse.y (simple_re_meta): escape all closing characters, not only round parenthesis. [ruby-core:53578] [Bug #8133] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r--test/ruby/test_regexp.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 308b30ae9c..46fd4531a0 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -180,9 +180,15 @@ class TestRegexp < Test::Unit::TestCase
end
def test_source_escaped_paren
- bug7610 = '[ruby-core:51088]'
- s = '\(a\)'
- assert_equal(/#{s}/, eval("%r(#{s})"), bug7610)
+ bug7610 = '[ruby-core:51088] [Bug #7610]'
+ bug8133 = '[ruby-core:53578] [Bug #8133]'
+ [
+ ["(", ")", bug7610], ["[", "]", bug8133],
+ ["{", "}", bug8133], ["<", ">", bug8133],
+ ].each do |lparen, rparen, bug|
+ s = "\\#{lparen}a\\#{rparen}"
+ assert_equal(/#{s}/, eval("%r#{lparen}#{s}#{rparen}"), bug)
+ end
end
def test_source_unescaped