summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-18 03:24:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-18 03:24:32 +0000
commit2e752da616efd57083dbac93b4b6b2347e42a65c (patch)
tree9893d52ae7dc033e1ea394ede44b6f85715b3339 /test
parent65fc6198c54393317c8dd76620791cae2cec022b (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/branches/ruby_1_8@13085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_system.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb
index f3a7159..3513577 100644
--- a/test/ruby/test_system.rb
+++ b/test/ruby/test_system.rb
@@ -4,7 +4,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