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('/(?.)/ =~ "a"; foo')) assert_equal("a", eval('foo = 1; /(?.)/ =~ "a"; foo')) assert_equal("a", eval('1.times {|foo| /(?.)/ =~ "a"; break foo }')) - assert_raise(SyntaxError) { eval('/(?.)/ =~ "a"') } + assert_nothing_raised { eval('/(?.)/ =~ "a"') } + assert_nil(eval('/(?.)/ =~ "a"; defined? Foo')) + end + + def test_assign_named_capture_to_reserved_word + /(?.)/ =~ "a" + assert(!local_variables.include?(:nil), "[ruby-dev:32675]") end def test_match_regexp