mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
77cc5f2031
commit
54a3576eaa
3 changed files with 13 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Aug 18 12:24:30 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep
|
||||
comment lines first.
|
||||
|
||||
Sat Aug 18 11:44:59 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* compile.c (iseq_set_arguments), insnhelper.ci
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue