From 77519504b2d2c54ea695396bdddcb41f7544a5cb Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 18 Aug 2007 03:24:32 +0000 Subject: * sample/test.rb, test/ruby/test_system.rb(valid_syntax?): keep comment lines first. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_system.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb index 4cd93738f..d70d6f8ca 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 -- cgit