ruby-changes:12056
From: nobu <ko1@a...>
Date: Wed, 17 Jun 2009 15:23:08 +0900 (JST)
Subject: [ruby-changes:12056] Ruby:r23723 (trunk): * sample/test.rb (valid_syntax?): should not capture BOM.
nobu 2009-06-17 15:22:58 +0900 (Wed, 17 Jun 2009) New Revision: 23723 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23723 Log: * sample/test.rb (valid_syntax?): should not capture BOM. * test/ruby/test_system.rb (TestSystem#valid_syntax?): ditto. Modified files: trunk/sample/test.rb trunk/test/ruby/test_system.rb Index: sample/test.rb =================================================================== --- sample/test.rb (revision 23722) +++ sample/test.rb (revision 23723) @@ -1931,7 +1931,7 @@ def valid_syntax?(code, fname) p fname code = code.dup.force_encoding("ascii-8bit") - code.sub!(/\A(\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { + code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" } code.force_encoding("us-ascii") Index: test/ruby/test_system.rb =================================================================== --- test/ruby/test_system.rb (revision 23722) +++ test/ruby/test_system.rb (revision 23723) @@ -5,7 +5,7 @@ class TestSystem < Test::Unit::TestCase def valid_syntax?(code, fname) code = code.dup.force_encoding("ascii-8bit") - code.sub!(/\A(\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { + code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" } code.force_encoding("us-ascii") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/