ruby-changes:10400
From: nobu <ko1@a...>
Date: Mon, 2 Feb 2009 12:39:12 +0900 (JST)
Subject: [ruby-changes:10400] Ruby:r21944 (trunk): * sample/test.rb (valid_syntax?), test/ruby/test_system.rb
nobu 2009-02-02 12:39:01 +0900 (Mon, 02 Feb 2009) New Revision: 21944 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21944 Log: * sample/test.rb (valid_syntax?), test/ruby/test_system.rb (TestSystem::valid_syntax?): use catch and throw instead of return inside BEGIN block. Modified files: trunk/ChangeLog trunk/sample/test.rb trunk/test/ruby/test_system.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 21943) +++ ChangeLog (revision 21944) @@ -1,3 +1,9 @@ +Mon Feb 2 12:39:00 2009 Nobuyoshi Nakada <nobu@r...> + + * sample/test.rb (valid_syntax?), test/ruby/test_system.rb + (TestSystem::valid_syntax?): use catch and throw instead of + return inside BEGIN block. + Mon Feb 2 11:45:10 2009 Tanaka Akira <akr@f...> * ext/socket/rubysocket.h (cmsg_type_arg): declared. Index: sample/test.rb =================================================================== --- sample/test.rb (revision 21943) +++ sample/test.rb (revision 21944) @@ -1931,9 +1931,9 @@ p fname code.force_encoding("ascii-8bit") code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) { - "#$&#{"\n" if $1 && !$2}BEGIN{return true}\n" + "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" } - eval(code, nil, fname, 0) + catch {|tag| eval(code, binding, fname, 0)} rescue Exception STDERR.puts $!.message false Index: test/ruby/test_system.rb =================================================================== --- test/ruby/test_system.rb (revision 21943) +++ test/ruby/test_system.rb (revision 21944) @@ -6,9 +6,9 @@ def valid_syntax?(code, fname) code.force_encoding("ascii-8bit") code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) { - "#$&#{"\n" if $1 && !$2}BEGIN{return true}\n" + "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" } - eval(code, nil, fname, 0) + catch {|tag| eval(code, binding, fname, 0)} end def test_system -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/