mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02: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/branches/ruby_1_8@13085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
65fc6198c5
commit
2e752da616
4 changed files with 16 additions and 5 deletions
|
@ -1697,7 +1697,10 @@ else
|
|||
end
|
||||
|
||||
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)
|
||||
rescue Exception
|
||||
puts $!.message
|
||||
false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue