diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 03:24:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 03:24:32 +0000 |
commit | 54a3576eaa58463089a34f1b9cb713b3b864738e (patch) | |
tree | bb561786ebce17fea1875e4738fe3c8dd25295b6 | |
parent | 77cc5f203126933569bb28ec77f8d3fb9df78019 (diff) |
* sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep
comment lines first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sample/test.rb | 5 | ||||
-rw-r--r-- | test/ruby/test_system.rb | 5 |
3 files changed, 13 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Sat Aug 18 12:24:30 2007 Nobuyoshi Nakada <[email protected]> + + * sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep + comment lines first. + Sat Aug 18 11:44:59 2007 Koichi Sasada <[email protected]> * compile.c (iseq_set_arguments), insnhelper.ci diff --git a/sample/test.rb b/sample/test.rb index 768429d951..11d5555401 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1879,7 +1879,10 @@ end def valid_syntax?(code, fname) p fname - eval("BEGIN {return true}\n#{code}", nil, fname, 0) + code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) { + "#$&#{"\n" if $1 && !$2}BEGIN{return true}\n" + } + eval(code, nil, fname, 0) rescue Exception STDERR.puts $!.message false diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb index 4cd93738f9..d70d6f8ca4 100644 --- a/test/ruby/test_system.rb +++ b/test/ruby/test_system.rb @@ -3,7 +3,10 @@ require 'envutil' class TestSystem < Test::Unit::TestCase def valid_syntax?(code, fname) - eval("BEGIN {return true}\n#{code}", nil, fname, 0) + code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) { + "#$&#{"\n" if $1 && !$2}BEGIN{return true}\n" + } + eval(code, nil, fname, 0) end def test_system |