diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-23 02:22:27 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-23 02:22:27 +0000 |
commit | 64bc558cc5fe5f19ff47ce0715e3ddd557206eac (patch) | |
tree | b068fed6a1326f8a50f5a48d4759c8a5c29a53e3 /test/ruby/test_regexp.rb | |
parent | a3c87a785996e6c735522cb750d805be887cba98 (diff) |
add a test for [ruby-dev:32675] reported by Keita Yamaguchi.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r-- | test/ruby/test_regexp.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index d4b306ced7..520af49640 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -101,7 +101,13 @@ class TestRegexp < Test::Unit::TestCase assert_equal("a", eval('/(?<foo>.)/ =~ "a"; foo')) assert_equal("a", eval('foo = 1; /(?<foo>.)/ =~ "a"; foo')) assert_equal("a", eval('1.times {|foo| /(?<foo>.)/ =~ "a"; break foo }')) - assert_raise(SyntaxError) { eval('/(?<Foo>.)/ =~ "a"') } + assert_nothing_raised { eval('/(?<Foo>.)/ =~ "a"') } + assert_nil(eval('/(?<Foo>.)/ =~ "a"; defined? Foo')) + end + + def test_assign_named_capture_to_reserved_word + /(?<nil>.)/ =~ "a" + assert(!local_variables.include?(:nil), "[ruby-dev:32675]") end def test_match_regexp |