1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
akr 2007-12-23 02:22:27 +00:00
parent a3c87a7859
commit 64bc558cc5

View file

@ -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