diff options
Diffstat (limited to 'test')
-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 |