diff options
| author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-04 16:30:19 +0000 |
|---|---|---|
| committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-04 16:30:19 +0000 |
| commit | 16f70c0e89f50e034a2a5d5cf2ec3d5127d34d6c (patch) | |
| tree | 5fdc584603cbfeaad47556e966de2085de826553 /test/ruby | |
| parent | 4090bd7b510cd745ffd88943a87bfb6e94537ead (diff) | |
merge revision(s) 41764,41765,41767: [Backport #8583]
* regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
https://bugs.ruby-lang.org/issues/8583
* [bug] (thanks Akinori MUSHA and Ippei Obayashi)
Fix a renumbering bug in condition regexp with a named
capture. [Bug #8583]
* [spec] (thanks Akinori MUSHA)
Allow ENCLOSE_OPTION in look-behind.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_regexp.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 46fd4531a0..a62e004918 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -942,4 +942,21 @@ class TestRegexp < Test::Unit::TestCase err = assert_raise(TypeError){ Regexp.quote(42) } assert_equal 'no implicit conversion of Fixnum into String', err.message, bug7539 end + + def test_conditional_expression + bug8583 = '[ruby-dev:47480] [Bug #8583]' + + conds = {"xy"=>true, "yx"=>true, "xx"=>false, "yy"=>false} + assert_match_each(/\A((x)|(y))(?(2)y|x)\z/, conds, bug8583) + assert_match_each(/\A((?<x>x)|(?<y>y))(?(<x>)y|x)\z/, conds, bug8583) + end + + def assert_match_each(re, conds, msg = nil) + errs = conds.select {|str, match| match ^ (re =~ str)} + msg = message(msg) { + "Expected #{re.inspect} to\n" + + errs.map {|str, match| "\t#{'not ' unless match}match #{str.inspect}"}.join(",\n") + } + assert(errs.empty?, msg) + end end |
