From 16923c25a1d1d3bcb8177737a682cc1084de8c2b Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 4 Jul 2010 12:01:46 +0000 Subject: * test/ruby/test_system.rb (test_syntax2): moved from sample/test.rb [ruby-dev:41721] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/test.rb | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'sample') diff --git a/sample/test.rb b/sample/test.rb index fc7a7f5db7..496856e444 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1921,34 +1921,6 @@ test_ok(done) File.unlink "script_tmp" or `/bin/rm -f "script_tmp"` File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"` -$bad = false -if (dir = File.dirname(File.dirname(__FILE__))) == '.' - dir = "" -else - dir << "/" -end - -def valid_syntax?(code, fname) - p fname - code = code.dup.force_encoding("ascii-8bit") - code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { - "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" - } - code.force_encoding("us-ascii") - catch {|tag| eval(code, binding, fname, 0)} -rescue Exception - STDERR.puts $!.message - false -end - -for script in Dir["#{dir}{lib,sample,ext,test}/**/*.rb"].sort - unless valid_syntax? IO::read(script), script - STDERR.puts script - $bad = true - end -end -test_ok(!$bad) - test_check "const" TEST1 = 1 TEST2 = 2 -- cgit v1.2.3