ruby-changes:3018
From: ko1@a...
Date: 23 Dec 2007 11:22:36 +0900
Subject: [ruby-changes:3018] akr - Ruby:r14510 (trunk): add a test for reported by Keita Yamaguchi.
akr 2007-12-23 11:22:27 +0900 (Sun, 23 Dec 2007) New Revision: 14510 Modified files: trunk/test/ruby/test_regexp.rb Log: add a test for [ruby-dev:32675] reported by Keita Yamaguchi. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_regexp.rb?r1=14510&r2=14509 Index: test/ruby/test_regexp.rb =================================================================== --- test/ruby/test_regexp.rb (revision 14509) +++ test/ruby/test_regexp.rb (revision 14510) @@ -101,9 +101,15 @@ 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 r = /./ m = r.match("a") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml